Moving picture coding and/or decoding systems, and variable-length coding and/or decoding system

ABSTRACT

A coding and/or decoding system includes: a code-word table for storing therein a plurality of code words, which are capable of being decoded both in forward and backward directions and which are formed so that delimiters of the code words are capable of being identified by a predetermined weight of the code words, so that the code words correspond to different source symbols; an encoder for selecting code words corresponding to inputted source symbols from the code-word table; and a synchronization interval setting part for preparing coded data every predetermined interval using the code words selected by the encoder and for inserting stuffing codes capable of being decoded in the backward direction. Thus, it is possible to decrease useless bit patterns to enhance the coding efficiency by smaller amounts of calculation and storage, and to decode variable length codes both in the forward and backward directions even if the synchronization interval is set every interval using the stuffing bits.

[0001] This application is a continuation-in-part of U.S. patentapplication Ser. No. 08/616,809.

BACKGROUND OF THE INVENTION

[0002] The present invention relates generally to a variable lengthcoding and/or decoding system used for compression coding and/ordecoding moving picture signals or the like. More specifically, theinvention relates to a variable length coding and/or decoding systemcapable of decoding both in forward and backward directions, and arecording medium for recording data or programs for use in the system.

[0003] A variable length code is a code system of a short code length onaverage, which is obtained by assigning a short code length of codes toa frequently appearing symbols and a long code length of codes to ararely appearing symbols on the basis of the appearance frequency ofsymbols. Therefore, if a variable length code is used, the amount ofdata can be considerably compressed in comparison with the amount ofdata before being coded. As a method for forming such a variable lengthcode, the Huffman algorithm suitable for memoryless sources is known.

[0004] In general, there is a problem in that, if an error is mixed in avariable length code due to a channel error of coded data or the like, adecoding system can not correctly decode the data due to the propagationof influence of the error after the error is mixed therein. In order toavoid this problem, there is a typical method for insertingsynchronization patterns at intervals to prevent the propagation of anerror when there is a possibility that the error may occur in a channel.Bit patterns, which do not appear by any combinations of variable lengthcodes, are assigned to the synchronization patterns. According to thismethod, even if coded data can not be decoded due to an error occurringtherein, it is possible to prevent the propagation of the error tocorrectly decode the coded data by finding the next synchronizationpattern.

[0005] However, even if the synchronization patterns are used, the codeddata can not be decoded until the next synchronization pattern is foundfrom the position, at which the coded data can not be correctly decodeddue to the error occurring therein as shown in FIG. 1A.

[0006] Therefore, there is known a method for changing the variablelength codes from the usual configurations shown in FIGS. 2A through 2Cto the configurations shown in FIGS. 3A through 3C to form code words,which can be decoded in a usual Forward direction as well as in abackward direction as shown in FIG. 1B. Since the coded data of suchcode words are also readable in the backward direction, the code wordscan be also used for reverse reproduction in a storage medium, such as adisc memory, for storing the coded data. This variable length code,which can be decoded in the forward direction as well as in the backwarddirection, will be hereinafter referred to as a “reversible code”.

[0007] An example of the reversible code is disclosed in Japanese PatentLaid-Open No. 5-300027, entitled “Reversible Variable Length CodingSystem”. This publicly-known reversible code is a variable length code,which can also be decoded in the backward direction by adding bits tothe ends of code words of a Huffman code, which is a variable codecapable of being decoded in the forward direction as shown in FIGS. 2Athrough 2C, so that the respective code words are not coincident withother code words having longer code lengths as shown in FIGS. 3A through3C. However, this reversible code contains many useless bits to have along average code length since the bits are added to the ends of thecode words of the variable length code, which can be decoded only in theforward direction. Consequently, the coding efficiency is considerablydeteriorated in comparison with the variable length code, which can bedecoded only in the forward direction.

[0008] There is also a problem in that the conventional reversible codecan not be decoded in the backward direction if synchronizationintervals are set every predetermined intervals. For example, ITU-TH.263 (1996) can align synchronization patterns every 8 bits (=1 byte),i.e., it can set positions, at which the synchronization patterns can beinserted, every 1 byte. In order to realize such alignment ofsynchronization intervals, stuffing codes shown in FIG. 34 are insertedbefore the synchronization patterns. In such a case, in the conventionalreversible codes, there is a problem in that the backward decoding cannot be carried out due to the stuffing bits.

[0009] Moreover, when the reversible code is simply decoded, there is aproblem in that the circuit scale and the amount of operation have to betwice as large as those in a usual decoding system for variable lengthcodes, which can be decoded only in the forward direction, by the amountdecoded in the backward direction.

[0010] There is another problem in that the conventional reversible codecan not be decoded in the backward direction by syntax of inputinformation as the case may be. For example, in the case of sourcesymbols having syntax shown in FIG. 5A, the sign of symbol B isdetermined by symbol A. Coded data obtained by coding source symbolshaving such syntax can not be decoded in the backward direction sincethe symbol B can not be decoded unless the symbol A has been decoded asshown in FIG. 5B.

[0011] As a coding system used when the number of source symbols ishigh, there is a system using escape codes. This system using escapecodes has code words corresponding to a small number of source symbolshaving a high appearance frequency as a code-word table, and encodes alarge majority of source symbols having a low appearance frequency bythe combinations of escape codes and fixed length codes. Also in thissystem using escape codes, there has been provided a system for applyingescape codes to the prefix and suffix of a variable length code, similarto the variable length code capable of being decoded both in the forwardand backward directions.

[0012] In the conventional coding and/or decoding system using escapecodes, it is required to search the code-word table for the presence ofcode words in order to distinguish the code words existing in thecode-word table from the code words to be coded using escape codes.

[0013] That is, as described above, since the conventional reversiblecode, i.e., the variable length code capable of being decoded both inthe forward and backward directions, is formed by adding bits to thesuffix of code words of a variable length code capable of being decodedonly in the forward direction, there is a problem in that useless bitpatterns are increased to increase an average code length, so that thecoding efficiency is considerably deteriorated in comparison with thevariable length code capable of being decoded only in the forwarddirection. In addition, if the synchronization intervals are set everypredetermined intervals using stuffing bits, there is a problem in thatthe reversible code can not be decoded in the backward direction due tothe stuffing bits. Moreover, if the reversible code is simply decoded,there is a problem in that the circuit scale and the amount of operationhave to be twice as large as those in a usual decoding system forvariable length codes capable of being decoded only in the forwarddirection, by the amount decoded in the backward direction, and there isa problem in that it is not possible to decode in the backward directionby the syntax of input information as the case may be.

SUMMARY OF THE INVENTION

[0014] It is therefore an object of the present invention to eliminatethe aforementioned problems and to provide a variable length codingand/or decoding system, which can efficiently encode and/or decode databy a small amount of operation and a small memory capacity and which candecode both in forward and backward directions.

[0015] It is another object of the present invention to provide avariable length coding and/or decoding system, which can decrease thenumber of useless bit patterns to enhance the coding efficiency andwhich can decode both in forward and backward directions even ifsynchronization intervals are set every predetermined intervals usingstuffing codes.

[0016] It is further object of the present invention to provide avariable length coding and/or decoding system, which can decrease thenumber of useless bit patterns to enhance the coding efficiency, whichcan decrease the circuit scale and the amount of operation toefficiently decode by sequentially carrying out the decoding process,and which can decode both in forward and backward directions.

[0017] It is still further object of the present invention to provide avariable length coding and/or decoding system, which can decode both inforward and backward directions regardless of the syntax of inputtedsource symbols and which has a higher resistance to errors.

[0018] In order to accomplish the aforementioned and other objects,according to one aspect of the present invention, there is provided afirst variable length coding system, which assigns, to a plurality ofsource symbols, code words having a code length corresponding to theoccurrence probability of the source symbols and which outputs codewords corresponding to inputted source symbols as coded data, thevariable length coding system comprising: a code-word table for storingtherein a plurality of code words including codes words, which arecapable of being decoded both in forward and backward directions andwhich are formed so that delimiters of the code words are capable ofbeing determined by a predetermined weight of the code words, so thatthe plurality of code words correspond to source symbols; code-wordselecting means for selecting code words corresponding to inputtedsource symbols from the code-word table; and synchronization intervalsetting means for preparing coded data for each of predeterminedsynchronization intervals using code words selected by the code-wordselecting means and for inserting stuffing codes, which are capable ofbeing decoded in the backward direction.

[0019] The term “weight of code words” corresponds to a Hamming distancewith respect to the minimum or maximum value of the code words. When thecode words are binary codes, since all the minimum values of the codewords are “0” and all the maximum values are “1”, the weight of the codewords corresponds to the number of “1”s or “0”s. The position, at whichthe weight of the code words is a predetermined value, is a delimiter ofcode words in a variable length code.

[0020] In this variable length coding system, the delimiter of codewords, i.e., a variable length code of code words having a predeterminedcode length, is formed by the weight of the code words, i.e., a valueindependent of the order of the code words. Therefore, this variablelength code is a reversible code capable of being decoded both in theforward and backward directions since the delimiter can be identifiedboth in the forward and backward directions. Since the reversible codeis originally formed without adding excessive bits unlike a conventionalreversible code that a bit is added to the suffix of a variable lengthcode capable of being decoded only in the forward direction, it ispossible to obtain a variable length code having a small amount ofuseless bit patterns and a high coding efficiency.

[0021] In this variable length coding system, even if synchronizationintervals are set every predetermined interval, it is possible to decodethe reversible code in the backward direction using a stuffing codecapable of being decoded in the backward direction. That is, when thereversible code is decoded in the backward direction, the suffix of thereversible code (the prefix in the backward direction) must beidentified. However, if the stuffing code capable of being decoded inthe backward direction is used, the suffix of the reversible code can beidentified, so that the reversible code can be decoded in the backwarddirection.

[0022] According to another aspect of the present invention, there isprovided a second variable length coding system, which assigns, to aplurality of source symbols, code words having a code lengthcorresponding to the occurrence probability of the source symbols andwhich outputs code words corresponding to inputted source symbols ascoded data, the variable length coding system comprising: layering meansfor layering inputted source symbols in accordance with importance; acode-word table for storing therein a plurality of code words includingcodes words, which are capable of being decoded both in forward andbackward directions and which are formed so that the delimiters of thecode words are capable of being identified by a predetermined weight ofthe code words, so that the plurality of code words correspond to thesource symbols; code-word selecting means for selecting code wordscorresponding to the inputted source symbols layered by the layeringmeans, from the code-word table; and synchronization interval settingmeans for preparing coded data of each of layers for each ofpredetermined synchronization intervals using code words selected by thecode-word selecting means and for multiplexing the coded data of each oflayers.

[0023] In this variable length coding system, the inputted sourcesymbols are variable-length coded using the code-word table, and thesynchronization interval is set every layer, so that it is possible tocarry out the variable-length coding resistant to errors, which can bedecoded both in the forward and backward directions independent ofsyntax of the inputted source symbols.

[0024] In the first and second variable length coding systems, out ofthe plurality of code words stored in the code-word table, the codewords, which are capable of being decoded both in forward and backwarddirections and which are formed so that the delimiters of the code wordsare capable of being identified by a predetermined weight of the codewords, have preferably first and second code words capable of beingdecoded both in the forward and backward directions, the second codeword being added to at least one of the prefix and suffix of the firstcode word, or the second code word being added at least one ofimmediately before and after respective bits of the first code word.

[0025] Since the code words of this construction can correspond to awider probability distribution of source symbols, it is possible toenhance the coding efficiency and to design codes having a high degreeof freedom for the bit patterns of code words. Therefore, even ifsynchronization intervals are set using synchronization patterns, it ispossible to avoid the problem in pseudo synchronization due to thecoincidence of the synchronization pattern with the bit pattern of codewords.

[0026] In the first and second variable length coding systems, out ofthe plurality of code words stored in the code-word table, the codewords, which are capable of being decoded both in the forward andbackward directions and which are formed so that the delimiters of thecode words are capable of being identified by a predetermined weight ofthe code words, may have code words, which are capable of being decodedboth in the forward and backward directions and between the respectivelybits of which code words of a fixed length code are inserted bypredetermined bits.

[0027] Alternatively, the code words, which are capable of being decodedboth in the forward and backward directions and which are formed so thatthe delimiters of the code words are capable of being identified by apredetermined weight of the code words, may have first and second codewords, which are capable of being decoded both in forward and backwarddirections, the second code word being inserted between the respectivebits of the first code word.

[0028] Since the code words of this construction can correspond to awider probability distribution of source symbols, it is possible toenhance the coding efficiency and to design codes having a high degreeof freedom for the bit patterns of code words. Therefore, even ifsynchronization intervals are set using synchronization patterns, it ispossible to avoid the problem in pseudo synchronization due to thecoincidence of the synchronization pattern with the bit pattern of codewords.

[0029] According to further aspect of the present invention, a firstvariable length decoding system corresponds to the first variable lengthcoding system. The first variable length decoding system for decodingcoded data, which are of variable length codes of code words containingcode words, which are capable of being decoded both in forward andbackward directions and into which stuffing codes capable of beingdecoded in the backward direction are inserted every predeterminedsynchronization interval, comprises: synchronization interval detectingmeans for detecting a synchronization interval of the coded data;forward decoding means for decoding, in the forward direction, the codeddata in the synchronization interval detected by the synchronizationinterval detecting means; and backward decoding means for decoding, inthe backward direction, the data in the synchronization intervaldetected by the synchronization interval detecting means.

[0030] This variable length decoding system may have decoded-valuedetermining means for determining decoded values on the basis of thedecoded results of the forward decoding means and the backward decodingmeans.

[0031] The synchronization interval detecting means may detect the bitnumber of the coded data, e.g., by decoding the stuffing code in thebackward direction.

[0032] At least one of the forward decoding means and the backwarddecoding means may detect the coded data as an error when a code word,which does not exist in a code-word table of a variable length code,appears in the coded data, or detect as an error when the bit number ofthe decoded coded data is not coincident with the bit number oftransmitted coded data.

[0033] Alternatively, at least one of the forward and backward decodingmeans may detect as an error in the decoding processing when a decodedvalue obtained by decoding the coded data is inadequate,

[0034] On the other hand, the decoded-value determining means uses adecoded result, which is presumed to be correct, of decoded results ofthe forward decoding means and the backward decoding means, and abandonsa portion, which is not capable of being decoded in both of the decodedresults, when an error is detected by at least one of the forwarddecoding means and the backward decoding means.

[0035] Specifically, the decoded-value determining means:

[0036] (a) uses, as decoded values, only decoded values, in which noerror has been detected, when the error is detected in both of theforward decoding means and the backward decoding means and when the waysto the error detected positions do not overlap with each other;

[0037] (b) uses forward decoded results as decoded values for code wordsimmediately before a position, at which the error is found by theforward decoding means, and uses backward decoded results as decodedvalues for code words after the position, when errors are detected bothin the forward decoding means and the backward decoding means and whenthe ways to error detected positions overlap with each other;

[0038] (c) uses forward decoded results as coded values for code wordsimmediately before a position, at which the error is detected, and usesbackward decoded results as decoded values for code words after theposition, when the error is detected by only one of the forward decodingmeans and the backward decoding means; and

[0039] (d) abandons decoded values for code words at the position, atwhich the error has been decoded, and uses backward decoded results asdecoded values for code words after the position, when the error isdetected for the same code word by the forward decoding means and thebackward decoding means.

[0040] The decoded-value determining means may abandon all the portions,which may contain errors, when the errors are detected by at least oneof the forward decoding means and the backward decoding means.

[0041] When the decoded values are determined on the basis of thedecoded results of the forward and backward decoding means, which havethe function of detecting errors in the code words of the variablelength code, this variable length decoding system determines decodedvalues of coded data in accordance with the error detection results inthe forward decoding means and the backward decoding means, so that thereversible code outputted from the variable length coding system can beeffectively decoded to channel errors.

[0042] In addition, since the code capable of being decoded in thebackward direction is used as the stuffing code, even if thesynchronization intervals are set every predetermined interval using thestuffing code, the reversible code can be decoded in the backwarddirection.

[0043] According to still further aspect of the present invention, asecond variable length decoding system for decoding coded data, whichare of variable length codes of code words containing code words capableof being decoded both in forward and backward directions and into whichstuffing codes capable of being decoded in the backward direction areinserted every predetermined synchronization interval, comprises:synchronization interval detecting means for detecting a synchronizationinterval of the coded data; and bidirectional decoding means fordecoding the decoded data in the synchronization interval detected bythe synchronization interval detecting means, both in the forward andbackward directions.

[0044] The bidirectional decoding means may detect as an error of thedecoding process, when a decoded value obtained by decoding coded datais inadequate in at least one of the forward and backward decodingprocesses.

[0045] As the decoding methods by the bidirectional decoding means, thefollowing methods can be used.

[0046] (a) After the forward decoding process is carried out, thebackward decoding process is carried out from the suffix of the codeddata.

[0047] (b) When an error is detected in the forward decoding process,the forward decoding process is stopped and the backward decodingprocess is carried out from the suffix of the coded data.

[0048] (c) When an error is decoded in the forward decoding process, theforward decoding process is resumed from a position apart from theposition of the error by a predetermined distance.

[0049] (d) When an error is detected in the forward decoding process,the backward decoding process is carried out from a position apart fromthe position of the error by a predetermined distance to the position ofthe error.

[0050] (e) Only when an error is detected at the suffix of the codeddata in the forward decoding process, the backward decoding process iscarried out.

[0051] This second variable length decoding system may also havedecoded-value determining means for determining decoded values on thebasis of the decoded results of the forward decoding means and thebackward decoding means.

[0052] In this variable length decoding system, when the decodingprocess is carried out by the bidirectional decoding means having thefunction of detecting errors in the code words of the variable lengthcode, the decoding process of the coded data is switched in accordancewith the error detected results in the forward decoding process, so thatthe forward and backward decoding means can be commonly used. Therefore,the reversible code outputted from the variable length coding system canbe effectively decoded to the channel errors without greatly increasingthe circuit scale and the amount of operation.

[0053] According to another aspect of the present invention, a thirdvariable length decoding system corresponds to the third variable lengthcoding system. The third variable length decoding system for decodingcoded data every predetermined synchronization interval, the coded datacomprising variable length codes, which are of code words containingcode words capable of being decoded both in forward and backwarddirections, and the coded data being prepared by code wordscorresponding to layered source symbols to be multiplexed, comprises:dividing means for dividing the multiplexed coded data into respectivelayers; synchronization interval detecting means for detecting asynchronization interval of the coded data divided by the dividingmeans; forward decoding means for decoding, in the forward direction,the coded data in the synchronization interval detected by thesynchronization interval detecting means; backward decoding means fordecoding, in the backward direction, the data in the synchronizationinterval detected by the synchronization interval detecting means; andsynthesizing means for synthesizing decoded results of respective layersobtained by the forward decoding means and the backward decoding means.

[0054] This third variable length decoding system may also havedecoded-value determining means for determining decoded values on thebasis of the decoded results of the forward decoding means and thebackward decoding means.

[0055] If the third variable length decoding system is combined with thethird variable length coding system, it is possible to provide avariable length coding and/or decoding system, which can be decoded bothin the forward and backward directions regardless of the syntax ofsource symbols and which has a higher resistance to errors.

[0056] A recording medium, which has recorded therein variable lengthcoded data capable of being inputted and outputted by a first variablelength coding and/or decoding system of the present invention, readablyrecords therein: coded data including code words, which are capable ofbeing decoded both in forward and backward direction and which areformed so that the delimiters of the code words are identified by apredetermined weight of the code words; and data, in which stuffingcodes capable of being decoded in the backward direction everypredetermined synchronization interval are inserted into the coded data.

[0057] A recording medium having recorded therein transform coefficientdata capable of being produced by orthogonal transforming every block inan image coding and/or decoding system, to which a variable lengthcoding and/or decoding system of the present invention is applied,readably records therein: the transform coefficient data wherein aplurality of code words capable of being decoded both in forward andbackward directions correspond to orthogonal transform coefficientshaving high appearance frequencies except for the last orthogonaltransform coefficients of the block, for each of a plurality of codedmodes of the image coding and/or decoding system; data wherein aplurality of code words capable of being decoded both in the forward andbackward directions are commonly provided for a plurality of coded modesof the image coding and/or decoding system and correspond to orthogonaltransform coefficients having high appearance frequencies of the lastorthogonal transform coefficients of the block; data wherein transformcoefficient data having low appearance frequency are described by fixedlength codes, and code words capable of being decoded both in forwardand backward directions are added to the prefix and suffix thereof; anddata wherein stuffing codes capable of being decoded in the backwarddirection are inserted in the coded data every predeterminedsynchronization interval.

[0058] In addition, a recording medium, which has recorded thereinvariable length coded data capable of being inputted and outputted by avariable length coding and/or decoding system of the present invention,records therein: coded data including code words, which are capable ofbeing decoded both in forward and backward direction and which areformed so that the delimiters of the code words are identified by apredetermined weight of the code words; and data wherein stuffing codescapable of being decoded in the backward direction every predeterminedsynchronization interval are inserted into the coded data.

[0059] Moreover, a recording medium, which has recorded thereintransform coefficient data capable of being produced by orthogonaltransforming every block in an image coding and/or decoding system ofthe present invention, records therein: the transform coefficient datawherein a plurality of code words capable of being decoded both inforward and backward directions correspond to orthogonal transformcoefficients having high appearance frequencies other than the lastorthogonal transform coefficients of the block, for each of a pluralityof coded modes of the image coding and/or decoding system; data whereina plurality of code words capable of being decoded both in the forwardand backward directions are commonly provided for a plurality of codedmodes of the image coding and/or decoding system and correspond toorthogonal transform coefficients having high appearance frequencies ofthe last orthogonal transform coefficients of the block; data whereintransform coefficient data having low appearance frequency are describedby fixed length codes and code words capable of being decoded both inthe forward and backward directions are added to the prefix and suffixthereof; and data wherein stuffing codes capable of being decoded in thebackward direction are inserted in the coded data every predeterminedsynchronization interval.

[0060] In addition, a recording medium having recorded therein a programfor use in a variable length coding system, which assigns, to aplurality of source symbols, code words having a code length accordingto occurrence probability of the source symbols, to output code wordscorresponding to inputted source symbols as coded data, includes atleast the steps of: storing a code-word table wherein a plurality ofcode words including code words, which are capable of being decoded bothin forward and backward directions and which are formed so that thedelimiters of the code words are capable of being identified by apredetermined weight of the code words, correspond to source symbols;selecting code words corresponding to the inputted source symbols fromthe code-word table; and preparing coded data every synchronizationinterval by using the code words selected by the code-word selectingstep, and setting a synchronization interval to the code words byinserting stuffing codes capable of being decoded in the backwarddirection.

[0061] Moreover, a recording medium having recorded therein a programfor use in a variable length decoding system for decoding coded data,which are of variable length codes of code words including code wordscapable of being decoded both in forward and backward directions andinto which stuffing codes capable of being decoded in the backwarddirection are inserted every predetermined synchronization interval,includes at least the steps of: detecting a synchronization interval ofthe coded data; decoding the coded data in the synchronization intervaldetected by the synchronization interval detecting step in the forwarddirection; and decoding the coded data in the synchronization intervaldetected by the synchronization interval detecting step in the backwarddirection.

[0062] As described above, according to the present invention, it ispossible to provide a variable length coding and/or decoding system,which can efficiently code and decode with smaller amounts ofcalculation and storage and which can decode both in the forward andbackward directions.

[0063] According to the present invention, it is possible to provide avariable length coding and/or decoding system, which can decreaseuseless bit patterns to enhance the coding efficiency and which candecode both in the forward and backward directions even if thesynchronization intervals are set every predetermined interval using thestuffing code.

[0064] The code-word forming method of the present invention can beapplied to a wider probability distribution of source symbols and tocode words of a large number of source symbols, to which conventionalmethods can not be applied. Specifically, it can be applied to a movingpicture coding and/or decoding system, and it is possible to provide amoving picture coding and/or decoding system resistant to errors.

[0065] In addition, since this code-word forming method can enhance thecoding efficiency and design codes having a high degree of freedom forbit patterns of code words, even if synchronization intervals are set bymeans of synchronization patterns, it is possible to avoid the problemin pseudo synchronization due to the coincident of the synchronizationpattern with the bit pattern of the code words.

[0066] Moreover, according to the present invention, when the decodedvalues are determined on the basis of the forward and backward decodedresults, the reversible code can be effectively decoded to channelerrors by determining the decoded values of the coded data.

[0067] In addition, according to the present invention, when thedecoding process is carried out by the bidirectional decoding meanshaving the function of detecting errors in the code words of thevariable length code, if the decoding process of the coded data isswitched in accordance with the error detected results in the forwarddecoding process, the forward and backward decoding processes can becommonly used, so that decoding can be effectively carried out tochannel errors without greatly increasing the circuit scale and theamount of operation.

[0068] Moreover, according to the present invention, source symbols arelayered in accordance with importance to be variable-length coded on thecoding side, and coded data for each of layers are prepared everysynchronization interval and multiplexed, so that it is possible todecode both in the forward and backward directions regardless of thesyntax of source symbols and to carry out the variable length codingand/or decoding with a higher resistance to errors.

BRIEF DESCRIPTION OF THE DRAWINGS

[0069] In the drawings:

[0070]FIGS. 1A and 1B are schematic drawings, each illustrating atypical coding method for a reversible code;

[0071]FIG. 2A is a table explaining a usual variable length code;

[0072]FIG. 2B is a diagram illustrating a coding tree for decoding theusual variable length code in a forward direction;

[0073]FIG. 2C is a diagram illustrating a coding tree for decoding theusual variable length code in a backward direction;

[0074]FIG. 3A is a table explaining a conventional reversible code;

[0075]FIG. 3B is a diagram illustrating a coding tree for decoding theconventional reversible code in a forward direction;

[0076]FIG. 3c is a diagram illustrating a coding tree for decoding theconventional reversible code in a backward direction;

[0077]FIG. 4 is a diagram illustrating conventional stuffing bits;

[0078]FIGS. 5A and 5B are diagrams, each illustrating a conventionalsyntax of source symbols, which can not be decoded in the backwarddirection;

[0079]FIG. 6 is a block diagram of the first preferred embodiment of avariable length coding and/or decoding system according to the presentinvention;

[0080]FIG. 7 is a block diagram of a code-word table preparing part ofFIG. 6;

[0081]FIG. 8 is a diagram explaining a first code-word forming method ina code-word forming part of FIG. 7;

[0082]FIGS. 9A and 9B are diagrams illustrating decoding trees inforward and backward directions, respectively, which are prepared fromcode words formed by the first code-word forming method;

[0083]FIG. 10 is a diagram explaining a second code-word forming methodin the code-word forming part of FIG. 7;

[0084]FIG. 11 is a diagram explaining a third code-word forming methodin the code-word forming part of FIG. 7;

[0085]FIG. 12A is a diagram explaining a method for setting asynchronization interval using a synchronization pattern in asynchronization interval setting part;

[0086]FIG. 12B is a diagram explaining a method for setting asynchronization interval by describing a coded amount;

[0087]FIG. 13 is a diagram illustrating a first embodiment of stuffingbits;

[0088]FIG. 14 is a diagram illustrating a second embodiment of stuffingbits;

[0089]FIGS. 15A through 15D are diagrams explaining the operation of adecoded-value determining part of FIG. 7;

[0090]FIG. 16 is a schematic block diagram of the second preferredembodiment of a moving-picture coding and/or decoding system accordingto the present invention;

[0091]FIGS. 17A through 17C are diagrams, each illustrating a syntax ofa coded data in the second preferred embodiment of a moving-picturecoding and/or decoding system according to the present invention;

[0092]FIG. 18A is a block diagram of a moving-picture multiplexing partof FIG. 16;

[0093]FIG. 18B is a block diagram of a moving-picture multiplex dividingpart;

[0094]FIG. 19 is a table showing a part of a code-word table of INTRAand INTER non-LAST coefficients in the second preferred embodiments;

[0095]FIG. 20 is a table showing a part of a code-word table of INTRAand INTER non-LAST coefficients in the second preferred embodiment,which is continued from FIG. 19;

[0096]FIG. 21 is a table showing a part of a code-word table of INTRAand INTER non-LAST coefficients in the second preferred embodiment,which is continued from FIG. 20;

[0097]FIG. 22 is a table showing a first half of a code-word table ofINTRA and INTER LAST coefficients in the second preferred embodiment;

[0098]FIG. 23 is a table showing a second half of a code-word table ofINTRA and INTER LAST coefficients in the second preferred embodiment;

[0099]FIG. 24 is a code-word table of escape codes in the secondpreferred embodiment;

[0100]FIG. 25 is a diagram illustrating a coding system of code words,which are not contained in the code-word table in the second preferredembodiment;

[0101]FIG. 26 is a diagram showing the maximum zero run in a codeconfiguration in the second preferred embodiment;

[0102] FIGS. 27(a) through 27(d) are diagrams illustrating the operationof a decoded-value determining part in the second preferred embodiment;

[0103]FIG. 28 is a block diagram of the third preferred embodiment of avariable length coding and/or decoding system according to the presentinvention;

[0104]FIG. 29 is a diagram explaining a first code-word forming methodin a code-word forming part of FIG. 28;

[0105]FIG. 30 is a diagram explaining a second code-word forming methodin the code-word forming part of FIG. 28;

[0106]FIG. 31 is a diagram of a bidirectional code-word table, which iscommon to a forward code-word table and a backward code word table;

[0107]FIG. 32 is a block diagram of a decoder, to which a detection partis added;

[0108] FIGS. 33(a) through 33(d) are diagrams explaining a decodingmethod in the third preferred embodiment;

[0109] FIGS. 34(a) and 34(b) are diagrams explaining a decoded-valuedetermining method in a decoded-value determining part in the thirdpreferred embodiment;

[0110]FIG. 35 is a block diagram of the fourth preferred embodiment of avariable length coding and/or decoding system according to the presentinvention;

[0111]FIG. 36 is a block diagram of a variable length coding part of ahierarchy of FIG. 35;

[0112]FIG. 37 is a block diagram of a variable length encoding part of ahierarchy of FIG. 35;

[0113]FIGS. 38A through 38C are diagrams illustrating examples of thedata hierarchization and multiplexing in a data layering part and amultiplexing part of FIG. 35, respectively;

[0114]FIG. 39 is a diagram showing an example of a decoded-valuedetermining method in a decoded-value determining part of FIG. 37;

[0115]FIGS. 40A and 40B are diagrams showing a first embodiment of asyntax in a moving-picture coding system in a moving-picturemultiplexing part and a moving-picture multiplex dividing part when thevariable length coding and/or decoding system in the fourth preferredembodiment is incorporated into the moving-picture coding and/ordecoding system of FIG. 16, respectively;

[0116]FIGS. 41A and 41B are diagrams showing a second embodiment of asyntax in a moving-picture coding system in a moving-picturemultiplexing part and a moving-picture multiplex dividing part when thevariable length coding and/or decoding system in the fourth preferredembodiment is incorporated into the moving-picture coding and/ordecoding system of FIG. 16, respectively;

[0117]FIGS. 42A and 42B are diagrams showing a third embodiment of asyntax in a moving-picture coding system in a moving-picturemultiplexing part and a moving-picture multiplex dividing part when thevariable length coding and/or decoding system in the fourth preferredembodiment is incorporated into the moving-picture coding and/ordecoding system of FIG. 16, respectively;

[0118]FIGS. 43A and 43B are diagrams showing a fourth embodiment of asyntax in a moving-picture coding system in a moving-picturemultiplexing part and a moving-picture multiplex dividing part when thevariable length coding and/or decoding system in the fourth preferredembodiment is incorporated into the moving-picture coding and/ordecoding system of FIG. 16, respectively;

[0119]FIG. 44 is a table showing a part of a coding table of motionvectors in the fourth preferred embodiment;

[0120]FIG. 45 is a table showing a part of a coding table of motionvectors in the fourth preferred embodiment, which is continued from FIG.44;

[0121]FIG. 46 is a table showing a part of a coding table of motionvectors in the fourth preferred embodiment, which is continued from FIG.45;

[0122]FIG. 47 is a table showing a part of a coding table of motionvectors in the fourth preferred embodiment, which is continued from FIG.46;

[0123]FIG. 48 is a table showing a part of a coding table of motionvectors in the fourth preferred embodiment, which is continued from FIG.47;

[0124]FIG. 49 is a table showing a part of a coding table of motionvectors in the fourth preferred embodiment, which is continued from FIG.48;

[0125]FIG. 50 is a table showing a part of a coding table of motionvectors in the fourth preferred embodiment, which is continued from FIG.49;

[0126]FIG. 51 is a table showing a part of a coding table of motionvectors in the fourth preferred embodiment, which is continued from FIG.50;

[0127]FIG. 52 is a diagram explaining a one-dimensional prediction formotion vectors in the fourth preferred embodiment;

[0128]FIG. 53 is a diagram explaining a decoded-value determining methodin the case of the syntax of FIG. 40;

[0129]FIG. 54 is a diagram explaining a decoded-value determining methodin the case of the syntax of FIG. 41;

[0130]FIG. 55 is a block diagram of the sixth preferred embodiment of acoding and/or decoding system according to the present invention, whichshows a detailed construction of a code-word table preparing part ofFIG. 6;

[0131]FIG. 56 is a schematic block diagram of the seventh preferredembodiment of a moving-picture coding and/or decoding system accordingto the present invention;

[0132]FIGS. 57A and 57B are diagrams showing examples of syntax in amoving-picture coding system in a moving-picture multiplexing part and amoving-picture multiplex dividing part in the seventh preferredembodiment, respectively;

[0133]FIGS. 58A and 58B are diagrams showing examples of syntax in amoving-picture coding system in a moving-picture multiplexing part and amoving-picture multiplex dividing part in the seventh preferredembodiment, respectively;

[0134]FIGS. 59A and 59B are block diagrams of a moving-picturemultiplexing part and a moving-picture multiplex dividing part of FIG.55;

[0135]FIG. 60 is a block diagram of the eighth preferred embodiment of asource encoder according to the present invention;

[0136]FIG. 61 is a block diagram of the eighth preferred embodiments ofa source decoder according to the present invention;

[0137]FIG. 62 is a schematic diagram of a system incorporating the ninthpreferred embodiment of a variable length coding and/or decoding systemaccording to the present invention;

[0138]FIG. 63 is a flow chart showing the operation of the tenthpreferred embodiment of a variable length encoder according to thepresent invention;

[0139]FIG. 64 is a flow chart showing the operation of the tenthpreferred embodiment a forward variable length decoder according to thepresent invention;

[0140]FIG. 65 is a flow chart showing the operation of the tenthpreferred embodiment of a backward variable length decoder according tothe present invention;

[0141]FIG. 66 is an INDEX table of INTRA coefficients;

[0142]FIG. 67 is an INDEX table of INTER coefficients;

[0143]FIG. 68 is an INDEX table of LASR coefficients;

[0144]FIG. 69 is a code-word table in the tenth preferred embodiment;

[0145]FIG. 70 is a code-word table in the tenth preferred embodiment;

[0146]FIG. 71 is a fixed value code-word table of RUNs in the tenthpreferred embodiment;

[0147]FIG. 72 is a fixed value code-word table of LEVELs in the tenthpreferred embodiment;

[0148]FIG. 73 is a diagram illustrating a coding of code words, whichare contained in a code-word table;

[0149]FIG. 74 is a decoded-value table in the tenth preferredembodiment;

[0150]FIG. 75 is a decoded-value table in the tenth preferredembodiment, which is continued from FIG. 74; and

[0151]FIG. 76 is a diagram explaining the operation of a decoded-valuedetermining part.

DESCRIPTION OF THE PREFERRED EMBODIMENTS

[0152] Referring now to the accompanying drawings, the preferredembodiments of a coding and/or decoding system, according to the presentinvention, will be described below.

[0153] [First Preferred Embodiment]

[0154]FIG. 6 is a block diagram of the first preferred embodiment of avariable length coding and/or decoding system according to the presentinvention.

[0155] As shown in FIG. 6, the variable length coding and/or decodingsystem in the first preferred embodiment generally comprises a code-wordtable preparing part 101, a coding part 113, a transmission or storagesystem 105 and a decoding part 114. First, the functions of therespective parts will be briefly described. The code-word tablepreparing part 101 prepares a code-word table on the basis of theoccurrence probability of source symbols, and transmits code words to acode-word table 102 provided in the coding part 113 and a forwardcode-word table 111 and a backward code-word table 112, which areprovided in the decoding part 114. The coding part 113 encodes thesource symbols to a variable length code, and outputs the variablelength code as coded data to the transmission or storage system 105. Thedecoding part 114 decodes the coded data inputted via the transmissionor storage system 105 to reproduce the original source symbol.

[0156] The detailed constructions and operations of the respective partsin the first preferred embodiments will be described below.

[0157] First, in the coding part 113, inputted source symbols areinputted to an encoder 103. The coding part 113 comprises a code-wordtable 102, the encoder 103 and a synchronization interval setting part104. The code-word table 102 stores therein source symbols, which havebeen prepared by the code-word table preparing part 101, and code wordsof a variable length code so that the source symbols correspond to thecode words. The encoder 103 selects code words corresponding to theinputted source symbols from the code words stored in the code-wordtable 102, to output the selected code words. In the synchronizationinterval setting part 104, the code words selected by the encoder 103are grouped every synchronization interval, and stuffing bits capable ofbeing decoded both in forward and backward directions are inserted, tooutput coded data every synchronization interval. The coded data aretransmitted to the decoding part 114 via the transmission or storagesystem 105.

[0158] The decoding part 114 comprises a synchronization intervaldetecting part 106, a buffer 107, a forward decoder 108, a backwarddecoder 109, a decoded-value determining part 110, a forward decodingtable 111 and a backward decoding table 112. In the decoding part 114,the synchronization interval detecting part 106 detects thesynchronization intervals of coded data inputted by the transmission orstorage systems 105, and the buffer 107 stores the coded data. Theforward decoder 108 starts to decode the coded data stored in the buffer107 from the prefix of the coded data, and the backward decoder 109starts to decode the coded data stored in the buffer 107 from the suffixof the coded data.

[0159] The forward decoder 108 determines that an error is detected,when a bit pattern, which does not exist in the forward code-word table111, appears in the coded data and when coded data having a bit numberdifferent from the bit number of the buffer 107 is decoded. Similarly,the backward decoder 109 determines that an error is detected, when abit pattern, which does not exist in the backward code-word table 112,appears in the coded data and when coded data having a bit numberdifferent from the bit number of the buffer is decoded.

[0160] The decoded-value determining part 110 determines a decoded valueon the basis of a decoded result (hereinafter referred to as a “forwarddecoded result”) obtained by the forward decoder 108 and a decodedresult (hereinafter referred to as a “backward decoded result”) obtainedby the backward decoder 109, and outputs a final decoded result.

[0161]FIG. 7 is a block diagram of the coded-word table preparing part101. A code selecting part 21 receives information on the occurrenceprobability of source symbols, and selects a code system having ashortest average code length from selectable code systems to transmitthe selected result to a code-word forming part 22. The code-wordforming part 22 forms code word of a code selected by the code-wordselecting part 21.

[0162] The code words formed by the code-word forming part 22 are codewords of a variable length code (hereinafter referred to as a“reversible code”), which is formed so that the delimiters in the codecan be indicated on the basis of a predetermined weight of code wordsand which can be decoded both in forward and backward directions. Thiscode is disclosed, e.g., in Japanese Patent Laid-Open No. 7-89772 or7-260383.

[0163] In the first preferred embodiment, in order to increase thedegree of freedom for the bit pattern of code words corresponding to awider probability distribution, the following method for forming codewords in the code-word forming part 22 is used.

[0164]FIG. 8 shows a first method for forming code words of a reversiblecode in the code-word forming part 22. First, as shown on the left sideof FIG. 8, two binary series, each of which has a constant weight (theweight is the number of “1” in this case) in the order of short codelength and which have different weights (the weights are 0 and 1 in thiscase), are prepared. Then, as shown in the middle of FIG. 8, after “1”sare added to the prefix and suffix of the binary series to reverse thebits of the binary series, the two binary series are synthesized asshown on the right side of FIG. 8.

[0165] The code length of this variable length code can be determined bycounting the number of symbols at the beginnings of the respectivecodes. In the example of FIG. 8, when the first is “0”, the delimiter ofthe code (code length) can be identified if two “0”s appear, and whenthe first is “1”, the delimiter of the code can be identified if three“1”s appear. The variable length code shown in FIG. 8 can be decodedboth in forward and backward directions since the code wordscorresponding to all the source symbols A through J are assigned toleaves of a forward decoding tree shown FIG. 9A as well as leaves of abackward decoding tree shown in FIG. 9B.

[0166]FIG. 10 shows a second method for forming code words of areversible code in the code-word forming part 22. First, as shown on theleft side of FIG. 10, first and second reversible codes are prepared.Then, as shown in the middle of FIG. 10, a first one code word of thesecond reversible code is added to each of the suffixes of all the codewords of the first reversible code. Then, after all the code words ofthe second reversible code are added to the suffixes of all the codewords of the first reversible code one by one, the code words arerearranged as shown on the right side of FIG. 10 to form a newreversible code. By such a forming method, it is possible to form A×B(27 in this embodiment) new reversible codes, the number of which isobtained by multiplying the number A (A=9 in this embodiment) of thecode words of the first reversible code by the number B (B=3 in thisembodiment) of the code words of the second reversible code.

[0167] When the reversible code is decoded in the forward direction bythis forming method, the first reversible code is first decoded, andthen, the second reversible code is decoded. When the reversible code isdecoded in the backward direction, the second reversible code is firstdecoded, and then, the first reversible code is decoded. Therefore, thereversible code can be decoded both in the forward and backwarddirections.

[0168] Furthermore, in this embodiment, while the code words of thesecond reversible code have been added to the suffix of the code wordsof the first reversible code, the second reversible code may be added tothe prefix of the first reversible code. Alternatively, fixed lengthcodes may be added to both the suffix and prefix of the first reversiblecode. In addition, in this embodiment, while the first reversible codehas been different from the second reversible code, both may be thesame. Moreover, in this preferred embodiment, while variable lengthcodes have been used as both of the first and second reversible codes,any one of the first and second reversible codes may be changed to afixed length code.

[0169]FIG. 11 shows a third method for forming a reversible code in thecode-word forming part 21. First, as shown on the left side of FIG. 11,variable-length reversible codes and fixed-length reversible codes areprepared. Then, as shown on the right side of FIG. 11, the fixed-lengthreversible codes are added immediately after the respective bits of thecode words of the reversible codes. When K-bit fixed-length reversiblecodes are used by this forming method, H-bit code words can be changedto (K+1)H-bit code words to increase the number of code words by 2KH. Inthis embodiment, while the fixed length codes have been addedimmediately after the respective bits of the code words of thereversible codes, fixed length codes may be added immediately before therespective bits, or fixed length codes may be added both immediatelybefore and after the respective bits.

[0170] Referring to FIGS. 12A and 12B, examples of methods for settingsynchronization intervals of coded data in the synchronization intervalsetting part 104 will be described below.

[0171]FIG. 12A shows a method for setting synchronization intervals byinserting synchronization patterns. In this case, the synchronizationinterval detecting part 106 can detect the synchronization intervals bydetecting the first and last synchronization patterns of coded data. Inorder to set positions, at which synchronization patterns can beinserted, at predetermined intervals (every M-bit unit in this case),1-bit to M-bit stuffing codes are inserted into the suffixes of thecoded data.

[0172]FIG. 12B shows a method for describing the coding amount of thesynchronization interval on the prefix of the coded data, i.e., a methodfor inserting a pointer indicative of the end position of thesynchronization interval. In this case, the synchronization intervaldetecting part 106 can detect the synchronization interval by decodingthe description of the coding amount of the synchronization interval atthe prefix of the coded data. Since the unit of description of thecoding amount is a M-bit unit, 1-bit to M-bit stuffing codes areinserted into the suffix of the coded data.

[0173] The stuffing codes used for the methods of FIGS. 12A and 12B canbe decoded at least in the backward direction. FIG. 13 shows an exampleof such a stuffing code. This stuffing code can be decoded both in theforward and backward directions. This stuffing code is a variable lengthcode, the delimiter of which can be identified if “1” appears in thecase of 1 bit and if “0”s appear twice in the case of other bits, andwhich can be decoded both in the forward and backward directions. Thisstuffing code can be also decoded from the end of the synchronizationinterval in the backward direction, and the bit number of the coded datacan be calculated. The calculated result of the bit number of the codeddata is used for an error detection, which will be described later.

[0174] While the stuffing code has been inserted into the suffix of thecoded data in this embodiment, the stuffing code may be inserted intothe prefix or the internal portion of the coded data. The stuffing codemay be inserted into a portion in the synchronization interval at anypositions if there is no problem of syntax. Alternatively, the stuffingcode may be a code capable of being decoded only in the backwarddirection as shown in FIG. 14. The delimiter of this code can beidentified if “0” appears when being decoded in the backward direction.

[0175] Referring to FIGS. 15A through 15D, a method for determining adecoded value in the decoded-value determining part 110 will bedescribed below.

[0176] As shown in FIG. 15A, when the ways to the positions of thedecoded word (error detected positions), at which errors are detected,in the forward and backward decoded results, do not overlap with eachother, only the decoded results, in which the errors are not detected,are used for decoded values, and the decoded results at the two errordetected positions are abandoned. As shown in FIG. 15B, when the ways tothe error detected positions in the forward and backward decoded resultsoverlaps with each other, the forward decoded results are used fordecoded values before the error detected position in the forward decodedresults, and the backward decoded results are used for decoded valuesafter the error detected position in the forward decoded results.Alternatively, the backward decoded results may be preferentially usedfor decoded values before the error detected position in the backwarddecoded result, and the forward decoded results may be used for decodedvalues after the error detected position in the backward decoded result.

[0177] As shown in FIG. 15C, when an error is detected in only one ofthe forward and backward decoded results (an error is detected only inthe forward decoded result in the shown embodiment), the decoded valuesin the forward decoded result are used before the error detectedposition, and the decoded values in the backward decoded result are usedafter the error detected position. As shown in FIG. 15D, when errors aredetected in the same code word both in the forward and backward decodedresults, the decoded value for the code word at the error detectedposition is abandoned, and the decoded values in the backward decodedresult are used for the code words after the error detected position.When the error determination is carried out in the forward decoder 108and the backward decoder 109, if a bit pattern, which does not exist asa code word, appears, the position of the bit pattern is regarded as thedecoded position. When no error is detected in the above determiningmethod and when the decoded bit number is not coincident with the bitnumber of the coded data in the synchronization interval, the firstposition in decoding is regarded as the error detected position.

[0178] In this first preferred embodiment, while one example of adecoded-value determining method using four patterns of error detectedpositions has been described, the decoded-value determining part may useany methods, if the forward or backward decoded result presumed to becorrect is used and a portion, which has not been detected both in thedecoded results, is abandoned, when errors are detected in both or anyone of the forward and backward detected results.

[0179] [Second Preferred Embodiment]

[0180] As the second preferred embodiment of the present invention, anapplied example of a variable length coding and/or decoding systemaccording to the present invention will be described below.

[0181]FIG. 16 is a block diagram showing the concept of a moving picturecoding and/or decoding system, which incorporates the second preferredembodiment of a variable length coding and/or decoding system accordingto the present invention. First, in a moving picture encoder 709, thevariable length coding, multiplexing and so forth of data coded by asource encoder 702 are carried out by means of a moving picturemultiplexer 703. Then, the resulting data are smoothed by means of atransmission buffer 704 to be transmitted to a transmission or storagesystem 705 as coded data. A coding control part 701 controls the sourceencoder 702 and the moving picture multiplexer 703 in view of the buffercapacity of the transmission buffer 704.

[0182] On the other hand, in a moving picture 710, the coded datatransmitted from the transmission or storage system 705 are stored in areceiving buffer 706. Then, the multiplexing separation and variablelength decoding of the coded data are carried out by means of a movingpicture multiplexing separator 707 to be transmitted to a source decoder708, in which the moving picture information is finally decoded. To themoving picture multiplexer 703 and the moving picture multiplexingseparator 707, the firs preferred embodiment of a variable length codingand/or decoding system according to the present invention is applied.

[0183]FIGS. 17A through 17C shows syntax of a moving picture codingsystem in the moving picture multiplexer 703 and the moving picturemultiplexing separator 707 in the second preferred embodiment. The modeinformation, motion vector information and INTRA DC (DC components ofDCT coefficients in intraframe coding) information of macro blocks areapplied to an upper layer, and DCT coefficient information except forthe INTRA DC is applied to a lower layer. Reversible codes are appliedto the lower layer.

[0184]FIGS. 18A and 18B are block diagrams illustrating the movingpicture multiplexer 703 and the moving picture multiplexing separator707 in the second preferred embodiment. In the moving picturemultiplexer 703 shown in FIG. 18A, out of the data coded by the sourceencoder 702 of FIG. 16, the mode information, motion vector informationand INTRA DC information of macro blocks are applied to an upper layer,and the usual variable length coding is carried out by means of anupper-layer variable length encoder 901 to be transmitted to amultiplexer 903. Out of the data coded by the source encoder 702, DCTcoefficients other than the INTRA DC are coded by means of reversiblecodes in a lower-layer variable length encoder 902 to be transmitted tothe multiplexer 903. In the multiplexer 903, the coded data of the upperand lower layers are multiplexed to be transmitted to a transmissionbuffer 704.

[0185] On the other hand, in the moving picture multiplexing separatordecoder 707 shown in FIG. 18B, the coded data of the upper and lowerlayers are separated by means of a multiplexing separating part 904 tobe variable-length decoded by means of an upper-layer variable lengthdecoder 905 and a lower-layer variable length decoder 906, respectively.

[0186]FIGS. 19 through 21 and 22 through 23 show examples of code-wordtables used for the lower-layer variable length encoder 902. The codesstored in these code tables are obtained by adding 2-bit fixed-lengthcodes to the suffix of each o the codes prepared by the first formingmethod for the code words of the reversible code in the code-wordforming part 22.

[0187] In the source encoder 702, the interior of blocks is scannedevery block of 8×8 DCT coefficients after 3S quantization to deriveLASTs (0: non-zero coefficients, each of which is not the last of theblock, 1: non-zero coefficients of the last of the block), RUNs (thenumbers of zero runs before the non-zero coefficients) and LEVELs(quantized values of the coefficients), which are transmitted to themoving picture multiplexing part 703.

[0188] The lower-layer variable length encoder 902 in the moving picturemultiplexing part 703 has a code-word table of non-LAST coefficientsshown in FIGS. 19 through 21, wherein the code words of reversible codes(VLC_CODE) correspond to the non-LAST coefficients, RUNs and LEVELs ofthe INTRA (intraframe coding) and INTER (interframe coding), and acode-word table of LAST coefficients shown in FIGS. 22 and 23, whereinthe code words of the reversible codes (VLC_CODE) correspond to the LASTcoefficients, RUNs and LEVELs of the INTRA and INTER.

[0189] On the basis of the mode information, one of the. code-wordtables of the non-LAST coefficients and LAST coefficients of the INTRAis selected when the INTRA is carried out, and one of the code-wordtables of the non-LAST coefficient and LAST coefficients of the INTER isselected when the INTER is carried out, so that coding is carried out.The last bit “s” of the code word denotes the sign of the LEVEL. Whenthe “s” is “1”, the sign of the LEVEL is positive, and when the “s” is“1”, the sign of the LEVEL is negative.

[0190] With respect to coefficients, which do not exist in thesecode-word tables, 1 bit indicative of the LAST coefficient, the RUN andthe absolute value of the LEVEL are fixed-length coded as shown in FIG.25. In addition, the “00001” of two escape codes is added to the prefixof the fixed length code, and an escape code is also added to the suffixthereof. FIG. 24 shows a code-word table of escape codes. The last bit“s” of the VLC_CODE used as an ESCAPE code denotes the sign of theLEVEL. When the “s” is “0”, the LEVEL is positive, and when the “s” is“1”, the LEVEL is negative.

[0191]FIG. 26 shows the case that the zero run is maximum when thiscode-word table is used. Usually, a bit pattern, wherein “1” is addedafter zero runs continue, is selected as a synchronization pattern. Forexample, in the case of ITU-T H.263, a bit pattern, wherein “1” is addedafter 16 “0”s, is selected as a synchronization pattern. In thevariable-length coding of the DCT coefficients, the zero run is maximumwhen 15 “0”s continue in a case where the LEVEL is +64 in thecoefficient using an escape code and the next code also uses an escapecode. Therefore, if a bit pattern, in which 16 “0”s continue, is used asa synchronization pattern, there is no possibility that a pseudosynchronization pattern may be produced.

[0192] The decoded-value determining part 110 determines a decoded valueon the basis of the decoded result (hereinafter referred to as a“forward decoded result”) obtained by the forward decoder 108 and thedecoded result (hereinafter referred to as a “backward decoded result”)obtained by the backward decoder 109 to output a final decoded result.In the error determinations in the forward decoder 108 and the backwarddecoder 109, when a bit pattern, which does not exist as a code word,appears and when an error is detected by a check bit or the like, theposition of the bit pattern or the error is used as the detectedposition, and when no error is not detected by the above determiningmethod and when the decoded bit number is not coincident with the bitnumber of the coded data in the synchronization interval, the firstposition of decoding is used as the error detected position.

[0193]FIG. 27 shows a method for determining a decoded value in thelower layer. First, as shown in FIG. 27(a), when the ways to thepositions (the error detected positions) of macro blocks (MB), at whicherrors are detected in the forward and backward decoded results, do notoverlap with each other, only the decoded results of the macro blocks,in which no error is not detected, are used for decoded values, and thedecoded results at two error detected positions are not used for decodedvalues. In addition, the decoded results of the upper layer arerewritten on the basis of the decoded results of the mode information ofthe upper layer so that the INTRA macro blocks (intraframe coded macroblocks) are displayed using the last frame and the INTER macro blocks(interframe coded macro blocks) are displayed only by the motioncompensation using the last frame.

[0194] As shown in FIG. 27(b), when the ways to error detected positionsin the forward and backward decoded results overlap with each other, theforward decoded results before a macro block, in which an error isdetected as a result of the forward decoding, are used for decodedvalues, and the backward decoded results are used for decoded valuesafter the macro block. Alternatively, the backward decoded results maybe preferentially used for decoded results after a macro block, in whichan error is detected as a result of the backward decoding, and theforward decoded results may be used for decoded values before the macroblock.

[0195] As shown in FIG. 27(c), when an error is detected in only one ofthe forward and backward decoded results (an error is detected only inthe forward decoded result in the shown embodiment), the backwarddecoded results are used for decoded values with respect to the macroblocks after the error detected position.

[0196] As shown in FIG. 27(d), when errors are detected at the samemacro block both in the forward and backward decoded results, thedecoded values of the macro block at the error detected position areabandoned so as not to be used as decoded values. In addition, thedecoded results of the upper layer are rewritten on the basis of thedecoded results of the mode information of the upper layer so that theINTRA macro blocks are displayed using the last frame and the INTERmacro blocks are displayed only by the motion compensation using thelast frame. The backward decoded results are used for decoded valueswith respect to the macro block after the error detected position.

[0197] While the decoded values has been determined every macro block inthe decoded-value determining method of FIG. 27, the decoded values maybe determined every block or code word. In the second preferredembodiment, while the present invention has been applied to thevariable-length coding of the DCT coefficients, the invention may beapplied to other source symbols when the variable-length coding iscarried out.

[0198] [Third Preferred Embodiment]

[0199] Referring to FIG. 28, the third preferred embodiment of avariable length coding and/or decoding system, according to the presentinvention, will be described below.

[0200] In this third preferred embodiment, the variable length codingand/or decoding system generally comprises a code-word table preparingpart 101, a coding part 113, a transmission or storage system 105 and adecoding part 121. First, the functions of the respective parts will bebriefly described. The code-word table preparing part 101 prepares acode-word table on the basis of the occurrence probability of sourcesymbols, and transmits code words to a code-word table 102 in the codingpart 113 and to forward and backward code-word tables 111 and 112 in thedecoding part 121. The coding part 113 encodes the source symbol to avariable length code, and outputs the variable length code to thetransmission or storage system 105 as coded data. The decoding part 121decodes the coded data inputted via the transmission or storage system105 to reproduce the original source symbol.

[0201] The detailed constructions and operations of the respective partsin the third preferred embodiment will be described below.

[0202] The construction and operation of the coding part 113 are thesame as those in the first preferred embodiment shown in FIG. 6. Thatis, in the coding part 113, inputted source symbols are inputted to anencoder 103. The code-word table 102 stores therein source symbolsprepared by the code-word table preparing part 101 and code words ofvariable length codes so that the source symbols correspond to the codewords. The encoder 103 selects code words corresponding to the inputtedsource symbols from the code words stored in the code-word table 102. Ina synchronization interval setting part 104, the code words selected bythe encoder 103 are grouped every synchronization interval, and stuffingbits capable of being decoded both in forward and backward directionsare inserted into the code words to output coded data everysynchronization interval. The coded data are transmitted to the decodingpart 121 via the transmission or storage system 105.

[0203] The decoding part 121 comprises a synchronization intervaldetecting part 106, a buffer 107, a coded data switch 122, a decoder124, a code-word table switch 125, a decoded-value determining part 110,a forward decoding table 111 and a backward decoding table 112. Thecoded data switch 122 and the code-word table switch 125 are controlledby the decoder 124 to be switched. In the decoding part 121, while thesynchronization interval detecting part 106 inspects the synchronizationinterval of the coded data inputted by the transmission or storagesystems 105, the coded data are inputted to the decoder 124. At thistime, the coded data are also stored in the buffer 107. The decoder 124starts to decode the inputted coded data (hereinafter referred to as“forward decoding”). The decoder 124 determines that an error isdetected, when a bit pattern, which does not exist in the forwardcode-word table 111, appears and when coded data having a bit numberdifferent from the bit number of the buffer 107 is decoded.

[0204] When it is determined that an error has been detected, thedecoder 124 switches the code-word table in the code-word table switch123 from the forward code-word table 111 to the backward code-word table112. At this time, the input to the decoder 124 is switched to thebuffer 107 by means of the coded data switch 122. When thesynchronization interval detecting part 106 detects the nextsynchronization, the stored coded data are read out of the buffer 107from the suffix to be outputted to the decoder 124. The decoder 124starts to decode the inputted coded data (hereinafter referred to as“backward decoding”). Similar to the forward decoding, the decoder 124determines that an error is detected, when a bit pattern, which does notexist in the backward code-word table 112, appears in the coded data orwhen coded data having a bit number different from the bit number of thebuffer 107 are decoded. The decoded-value determining part 110determines decoded values on the basis of a decoded result (hereinafterreferred to as a “forward decoded results”) obtained by the forwarddecoding and a decoded result (hereinafter referred to as a “backwarddecoded results”) obtained by the backward decoding to output a finaldecoded result.

[0205] In the third preferred embodiment, the coded-word table preparingpart 101 is basically the same as that in the first preferredembodiment. As shown in FIG. 7, the code-word table preparing part 101inputs information on the occurrence probability of source symbols, andcomprises a code-word selecting part 21 for selecting a code systemhaving a least average code length from selectable code systems, and acode-word forming part 22 for forming code words of a code selected bythe code-word selecting part 21. In this preferred embodiment, thefollowing method for forming code words in the code-word forming part 22is used in order to increase the degree of freedom for a bit pattern ofcode words so as to correspond to a wider probability distribution.

[0206]FIG. 29 shows a first method for forming code words of areversible code in the code-word forming part 22. First, as shown on theleft side of FIG. 29, a first reversible code is prepared. Then, asshown in the middle of FIG. 29, fixed length codes of (code length−1)bits surrounded by the broken line are prepared for the respective codewords of the first reversible code, and as shown on the right side ofFIG. 29, the code words of the fixed length codes are inserted betweenthe respective bits of the code words of the first reversible code 1 bitby 1 bit so as to be surrounded by the broken line. It can be seen thatthe variable length codes of FIG. 29 can be decoded both in the forwardand backward directions by decoding the fixed length codes every 1 bitwhile decoding the first reversible code. In the embodiment of FIG. 29,while the code words of the fixed length codes have been insertedbetween the respective bits of the code words of the first reversiblecode 1 bit by 1 bit, fixed length codes of (code length−1)×n bits may beprepared for the respective code words of the first reversible code, andthe code words of the fixed length codes may be added between therespective bits of the code words of the first reversible code n bits byn bits.

[0207]FIG. 30 shows a second method for forming code words of areversible code in the code-word forming part 22. As shown on the leftside of FIG. 30, a first reversible code is prepared. Then, as shown onthe upper side of FIG. 30 so as to be surrounded by the broken line, asecond reversible code is prepared, and as shown on the right side ofFIG. 30, the second reversible code is inserted between the respectivebits of the code words of the first reversible code so as to besurrounded by the broken line. It can be seen that the variable lengthcodes of FIG. 30 can be decoded both in the forward and backwarddirections by decoding the second reversible code 1 bit by 1 bit whiledecoding the first reversible code. In the embodiment of FIG. 30, whilethe first and second reversible codes have been the same, these codesmay be different.

[0208] In the third preferred embodiment, as shown in FIG. 31, abidirectional code-word table 51 may be used as a common table in placeof the forward code-word table 111 and the backward code-word table 112shown in FIG. 28.

[0209] In this case, an identification signal 53 indicative of thediscrimination between the forward coding and the backward coding isinputted from the decoder 124 of FIG. 28, and an address converter 52 isoperated by the identification signal 53 to produce an address forreading code words out of the bidirectional code-word table 51. Then,the code value corresponding to this address is read out of thebidirectional code-word table 51.

[0210] In the third preferred embodiment, as shown in FIG. 32, thedecoder 124 has an error detection function. An error detecting part 62connected to a decoder 61 monitors the inside state of the decoder 61,and outputs an error detection signal when it is abnormal. For example,the abnormal inside states include the following states:

[0211] (1) when a coded data, which does not exist in the code-wordtable, is received;

[0212] (2) when the length of the coded data is not coincident with thelength of the code actually decoded by the decoder 61;

[0213] (3) when the decoded value is inadequate although the decodedvalue can be derived since it exists in the code-word table,specifically, (3-1) when the decoded value is beyond the range ofexistence, (3-2) when the number of data exceeds the upper limit, and(3-3) when a decoded value, which does not match with the previouslydecoded value, is outputted; and

[0214] (4) when an error has been detected by an error detection code orthe like.

[0215] Referring to FIG. 33, a decoding method in the third preferredembodiment will be described below.

[0216] In the preceding preferred embodiments, as shown in FIG. 33(a),the forward and backward decoding processes in the decoder 124 have beensimultaneously carried out until errors are detected in the respectiveprocesses, to derive decoded values. The third preferred embodimentshould not be limited thereto, but decoding may be carried out by themethods shown in FIGS. 33(b), 33(c) and 33(d). In FIGS. 33(b), 33(c) and33(d), X denotes error detected points, the arrow to the right denotesthe forward decoding process, and the arrow to the left denotes thebackward decoding process.

[0217] In the method shown in FIG. 33(b), the forward decoding processis carried out, and when an error is detected, the forward decodingprocess is stopped and the backward decoding process is carried out inthe backward direction from the suffix of the coded data in thesynchronization interval until an error is detected. In the method shownin FIG. 33(c), when an error is detected in the forward decodingprocess, the forward decoding process is resumed after n bits from theerror detected position. This process is repeated until all the codeddata in the present synchronization interval are processed. At the lastof the forward decoding process, when the number of the coded data inthe synchronization interval is not coincident with the number of datadecoded by the decoding process, it is determined that an error isdetected, and the backward decoding process is carried out from thesuffix of the coded data until an error is detected. In the method shownin FIG. 33(d), when an error is detected in the forward decodingprocess, the backward decoding process is carried out by n bits in thebackward direction from n bits after the error detected position.Thereafter, the forward decoding process is carried out after n bitsfrom the error detected position, i.e., the forward decoding process iscarried out from a position, at which the backward decoding process hasbeen started. This process is repeated until all the coded data in thepresent synchronization interval are processed. Finally, if the numberof the coded data in the synchronization interval is not coincident withthe number of data decoded by the decoding process, it is determinedthat an error is detected, and the backward decoding process is carriedout from the suffix of the coded data until an error is detected.

[0218] Referring to FIG. 34, a method for determining decoded values inthe decoded-value determining part 111 in the third preferred embodimentwill be described below. The decoded values finally utilized in thedecoded-value determining part 111 can be selected by the followingmethods.

[0219] In the decoded-value determining method shown in FIG. 34(a),after an error is detected, decoding is not carried out. That is, sincethere is a possibility that erroneous decoding may be carried out afteran error is detected, the decoded values, which may cause erroneousdecoding, are not utilized, and only the decoded values before the errordetected position are utilized.

[0220] In the decoded-value determining method shown in FIG. 34(b), evenif an error is detected, decoding is continued to utilize all the usabledecoded values. Variable length codes include a code, in whichsynchronization can be automatically recovered if the decoding processis continuously carried out even if the synchronization is not broken.This is called “self-synchronization-recovery. In the case of a codeword having a high self-synchronization-recovery capability, it ispossible to obtain a greater amount of correct decoded values bycontinuing the decoding process as shown in FIG. 34(b) without stoppingthe decoding process as shown in FIG. 34(a) after the error is detected.However, in this case, there is a possibility that the decoded valuesmay include erroneously decoded values. In the system for allowing sucha possibility of erroneous decoding, the decoded-value determiningmethod of FIG. 34(b) may be used.

[0221] [Fourth Preferred Embodiment]

[0222] Referring to FIG. 35, the fourth preferred embodiment of avariable length coding and/or decoding system, according to the presentinvention, will be described below.

[0223] In the fourth preferred embodiment, the variable length codingand/or decoding system generally comprises a code-word table preparingpart 201, a coding part 213, a transmission or storage system 205 and adecoding part 214. First, the functions of the respective parts will bebriefly described.

[0224] The code-word table preparing part 201 prepares a code-word tableon the basis of the occurrence probability of source symbols, totransmit code words to a code-word table in the coding part 213 and toforward and backward code-word tables in the decoding part 214.

[0225] The coding part 213 layers source symbols provided as input data,and encodes the input data every layer to variable length codes. Then,the coding part 213 multiplexes the variable length codes to output themultiplexed codes to the transmission or storage system 205. Thedecoding part 214 multiplexing-separates the coded data inputted via thetransmission or storage system 205 to variable-length decode theresulting data every layer to synthesize decoded results every layer toreproduce the original source symbols to output reproduced data.

[0226] The detailed constructions and operations of the respective partsin the fourth preferred embodiment will be described below.

[0227] In the coding part 213, the source symbols being input data aredivided, by means of a data layering part 202, into layers 1 through n(n is a natural number being not less than 2) in accordance withimportance. The divided source symbols in the respective layers i (i=1,2, . . . , n) are inputted to variable length coding parts 203-iprepared every layer i to be coded. The coded data of the respectivelayers i obtained by the variable length coding parts 203-i aremultiplexed by means of a multiplexing part 204 to be transmitted to thedecoding part 214 via the transmission or storage system 205.

[0228] In the decoding part 214, the coded data inputted by thetransmission or storage system 205 are divided into coded data of therespective layers i by means of a multiplexing separating part 206. Thedivided coded data of the respective layers are inputted tovariable-length decoding parts 207-i prepared every layers i to bedecoded. The decoded results of the respective layers i obtained by thevariable length decoding parts 207-i are synthesized by means of a datasynthesizing part 208 to be outputted as reproduced data.

[0229] The construction of the code-word table preparing part 201 is thesame as that of the code-word table preparing part 101 in the firstpreferred embodiment shown in FIG. 7. The code-word table preparing part201 selects a code system having a shortest average code length fromselectable code systems on the basis of information on the occurrenceprobability of source symbols, to form code words of the selected code.The code words are variable length codes (reversible codes), which areformed so that the delimiters between codes can be identified by apredetermined weight of code words and which can be decoded both inforward and backward directions.

[0230] The construction of each of the variable length coding parts203-i of the respective layers i of FIG. 35 is shown in FIG. 36. Similarto the coding part 113 shown in FIG. 6, each of the variable lengthcoding parts 203-i comprises a code-word table 102, an encoder 103 and asynchronization interval setting part 104. That is, the source symbolsinputted from the data layering part 202 of FIG. 35 are inputted to theencoder 103. The code-word table 102 stores therein source symbolspreviously prepared by the code-word table preparing part of FIG. 35 andcode words of variable length codes so that the source symbolscorrespond thereto.

[0231] The encoder 103 selects code words corresponding to the sourcesymbols inputted by the data layering part 202, from the code wordsstored in the code-word table 102 to output the selected code words. Thesynchronization interval setting part 104 groups the code words selectedby the encoder 103 every synchronization interval, and inserts stuffingcodes, which can be decoded both in forward and backward directions,into the grouped code words if necessary, to output coded data everysynchronization interval. The coded data are transmitted to themultiplexing part 204 of FIG. 35.

[0232] On the other hand, the construction of each of the variablelength decoding parts 207-i of the respective layers i of FIG. 35 isshown in FIG. 37. Similar to the decoding part 114 shown in FIG. 6, eachof the variable length decoding parts 207-i comprises a synchronizationinterval detecting part 106, a buffer 107, a forward decoder 108, abackward decoder 109, a decoded-value determining part 110, a forwarddecoding table 111 and a backward decoding table 112. That is, in thevariable length decoding part 207-i, the synchronization intervals ofthe coded data inputted from the transmission or storage system 205 bythe synchronization interval detecting part 106 and the coded data arestored in the buffer 107. The forward decoder 108 starts to decode thecoded data stored in the buffer 107 from the prefix of the coded data.The backward decoder 109 starts to decode the coded data stored in thebuffer 107 from the suffix of the coded data.

[0233] The forward decoder 108 determines that an error is detected,when a bit pattern, which does not exist in the forward code-word table111, appears in the coded data or when the coded data having a bitnumber different from the bit number of the buffer 107 is decoded.Similarly, the backward decoder 109 determines that an error isdetected, when a bit pattern, which does not exist in the backwardcode-word table 112, appears in the coded data or when the coded datahaving a bit number different from the bit number of the buffer 107 isdecoded. The decoded-value determining part 110 determines decodedvalues on the basis of a decoded result (a forward decoded result)obtained by the forward decoder 108 and a decoded result (a backwarddecoded result) obtained by the backward decoder 109, to output a finaldecoded result. The decoded results of the respective layers i aretransmitted to the data synthesizing part 208.

[0234]FIGS. 38A through 38C show examples of the data hierarchization inthe data layering part 202 and the multiplexing in the multiplexing part204. If there are input data (a source symbol string) of syntax, whichcan be divided into n layers as shown in FIG. 38A, the data layeringpart 202 changes the syntax to carry out the data hierarchization sothat the input data are repeated every layer i as shown in FIG. 38B, andtransmits the source symbols to the variable length coding part 203-ievery layer i. In the multiplexing part 204, as shown in FIG. 38C, thesource symbols are variable-length coded by the variable length codingpart 203-i every layer i, and the coded data, in which thesynchronization intervals are set by adding the synchronization patterni, are multiplexed to be outputted.

[0235]FIG. 39 shows an example of a method for determining decodedvalues in the decoded-value determining part 110 of FIG. 37. In thevariable length decoding part 207-i of the respective layer i, thebidirectional decoding is carried out. If there is an error in thedecoded data inputted to the variable length decoding part of a certainlayer, the error affects the decoded values of upper and lower layersthan the certain layer. Therefore, the decoded-value determining part110 in the variable length decoding part 207-i of the respective layer iexchanges information to determine the final decoded value.

[0236] In the embodiment of FIG. 39, if there is an undecodable portionin the upper layer due to an error, an undecodable portion is producedin the decoded data of the lower layer relating thereto. In addition, ifthere is an undecodable portion in the coded data of the lower layer dueto an error, the decoded values of the coded data of the upper layercorresponding thereto are changed. FIG. 39 merely shows one example of adecoded-value determining method. Therefore, it is possible to utilizeany methods, wherein the decoded-value determining part 110 in thevariable length decoding part 207-i of each of the layers i uses adecoded result, which is presumed to be correct, of the forward andbackward decoded results when an error is detected in at least one ofthe forward and backward decoded results using the decoded results ofthe upper and lower layers, and wherein the decoded result of a portion,which could not have been decoded both in the forward and backwarddecoding processes, is abandoned. In the fourth preferred embodiment,while the reversible codes have been used both in the forward andbackward directions in all the layers, reversible codes may be used onlyin a part of layers.

[0237] [Fifth Preferred Embodiment]

[0238] The fifth preferred embodiment, wherein the variable lengthcoding and/or decoding system in the fourth preferred embodiment isapplied to the moving picture multiplexing part 703 and the movingpicture multiplexing separating part 707 of the moving picture codingand/or decoding system shown in FIG. 16, will be described below. Inthis case, the basic construction of the moving picture coding and/ordecoding system is the same as that in the second preferred embodiment,except that the variable length coding and decoding processes in themoving picture multiplexing part 703 and the moving picture multiplexingseparating part 707 are carried out every layer.

[0239]FIGS. 40A, 40B, 41A, 41B, 42A, 42B, 43A and 43B show variousexamples of syntax of a moving picture coding system in the movingpicture multiplexing part 703 in the fifth preferred embodiment. First,the syntax shown in FIGS. 40A and 40B will be described. In this syntax,inputted source symbols being coded data are divided into two layers,i.e., an upper layer and a lower layer, and synchronization intervalsare set for the respective layers using synchronization patterns RM andMM. Symbol ST at the suffix of the syntax of the lower layer is astuffing code capable of being decoded in the backward direction shownin FIG. 14.

[0240] As shown in FIG. 40A, the upper layer includes a headerinformation and a mode information, which is arranged on the side of theprefix and which includes coding modes for each of macro blocks,information on the need for coding the respective blocks, and values ofINTRA DC. These informations are described by variable length codescapable of being decoded in the usual forward direction. In addition,motion vector informations are variable-length coded to reversible codesby means of coding tables shown in FIGS. 44 through 51 to be arrangedafter the header and mode informations. In the coding tables shown inFIGS. 44 through 51, “VECTOR DIFFERENCES” denotes predicted values(differential values) of motion vectors, “BIT NUMBER” denotes codelengths of variable length codes, and “VLC CODE” denotes variable lengthcodes.

[0241] As shown in FIG. 52, motion vectors are obtained byone-dimensional predictions, and predicted values are represented bydifferential values. The predicting directions of the motion vector isshown by arrows in FIG. 52. As shown in FIG. 52, a macro block (shown bya greater rectangle in FIG. 52) has one motion vector or four motionvectors, each of which exists in each of luminance blocks (shown bysmaller rectangles in FIG. 52). The one-dimensional prediction iscarried out with respect to these blocks, and predicted values aredescribed by variable length codes in accordance with the coding tablesshown in FIGS. 44 through 51. This corresponds to the motion vectorinformation at the end of FIG. 40A. On the other hand, as shown in FIG.40B, the lower layer has DCT coefficient information other than theINTRA DC. For example, the lower layer is described by reversible codes,which are shown in FIGS. 19 through 25 or disclosed in Japanese PatentApplication No. 7-260383.

[0242] The syntax shown in FIGS. 41A and 41B will be described. In thissyntax, as shown in FIG. 41A, a header information and a modeinformation 1 indicative of the number of motion vectors for each macrocoding are arranged on the side of the prefix of the upper layer to bedescribed by variable length codes capable of being decoded in the usualforward direction, and the variable length codes of the motion vectorsare described after the header information and the mode information. Thevariable length codes of the motion vector information are the same asthose of the syntax of FIG. 40A. As shown in FIG. 41B, a modeinformation 2 indicative of the presence of DCT coefficients in therespective blocks and the INTRA DC are arranged on the side of theprefix of the lower layer to be described by variable length codescapable of being decoded in the usual forward direction, and a DCTcoefficient information other than the INTRA DC is described byreversible codes after the DCT coefficient information similar to thesyntax of FIG. 40B.

[0243] The syntax shown in FIGS. 42A and 42B will be described. In thissyntax, only variable length codes capable of being decoded in theforward direction are used for the upper layer. That is, as shown inFIG. 42A, in the upper layer, a header information, a mode informationand a motion vector information are described by variable length codescapable of being decoded in the forward direction. In the lower layer,as shown in FIG. 42B, a DCT coefficient information is described byreversible codes similar to the syntax of FIG. 40B.

[0244] The syntax shown in FIGS. 43A and 43B also uses, in the upperlayer, only variable length codes capable of being decoded in theforward direction. That is, as shown in FIG. 43A, in the upper layer, aheader information, a mode information 1 indicative of the number ofmotion vectors for each macro coding, and a motion vector informationare described by variable length codes capable of being decoded in theforward direction. As shown in FIG. 43B, in the lower layer, a modeinformation 2 indicative of the presence of DCT coefficient of eachblock, and an INTRA DC are arranged on the side of the prefix to bedescribed by variable length codes capable of being decoded in the usualforward direction, and in the rear thereof, a DCT coefficientinformation other than the INTRA DC is described by reversible codessimilar to the syntax of FIG. 41B.

[0245] In the fifth preferred embodiment, although the basicconstructions of the moving picture multiplexing part 703 and the movingpicture multiplexing separating part 707 are the same as those of FIGS.18A and 18B, the constructions of the upper-layer variable lengthencoder 901, the lower-layer variable length encoder 903, theupper-layer variable length decoder 905 and the lower-layer variablelength decoder 906 are different from those in the second preferredembodiment. That is, out of data coded by the source encoder 702, theupper layer data indicated by, e.g., the syntax of FIG. 40A or 41A, arevariable-length coded by means of the upper-layer variable lengthencoder 901 to be transmitted to the multiplexing part 903. In addition,out of data coded by the source encoder 702, the lower layer dataindicated by the syntax of FIG. 40B or 41B are variable-length coded bymeans of the lower-layer variable length encoder 903 to be transmittedto the multiplexing part 903. In the multiplexing part 903, the codeddata in the upper and lower layers are multiplexed to be transmitted tothe transmission buffer 704.

[0246] In the fifth preferred embodiment, the decoded-value determiningpart 110 (shown in FIG. 37) in the upper-layer variable length decoder905 and the lower-layer variable length decoder 906 determines decodedvalues on the basis of the forward decoded result obtained by theforward decoder 108, to output a final decoded result. In the errordetection in the forward decoder 108 and the backward decoder 109 in therespective layers, when a bit pattern, which does not exist as codewords, appears or when an error is detected by a check bit or the like,the position of the bit pattern or the error is regarded as a detectedposition. When no error is detected by the above described determiningmethod and when the number of decoded bits is not coincident with thebit number of coded data in the synchronization interval, the firstdecoding position is regarded as an error detected position.

[0247] In the fifth preferred embodiment, a decoded-value determiningmethod will be described below.

[0248]FIG. 53 shows a decoded-value determining method when the syntaxof the moving picture coding system in the moving picture multiplexingpart 703 is the syntax shown in FIGS. 40A and 40B. Since the syntax ofFIGS. 40A and 40B uses reversible codes for the motion vectorinformation of the upper layer and the DCT coefficient information ofthe lower layer, the bidirectional decoding can be carried out both inthe upper and lower layers.

[0249] In the upper layer, the header information and the modeinformation are first decoded. When the header information and/or themode information can not be completely decoded due to an error, all thedecoded values of the macro blocks of a synchronization interval, inwhich the error occurs, are regarded as “Not Coded”, and the last screenis directly displayed. If all the header information and the modeinformation can be decoded, the bidirectional decoding of the motionvector information is then carried out. A portion of the motion vectorinformation, which can not decoded, is regarded as “Not Coded”. In thelower layer, the DCT coefficient information of the lower layer is usedfor only macro blocks, which have been decoded to the motion vector. Themacro blocks, in which the DCT coefficient information has beenabandoned due to the error, are regarded as “Not Coded”.

[0250]FIG. 54 shows a decoded-value determining method when the syntaxof the moving picture coding system in the moving picture multiplexingpart 703 is the syntax shown in FIG. 41. According to the syntax of FIG.41, in the upper layer, the header information and the mode information1 are first decoded. If the header information and/or the modeinformation 1 can not be completely decoded due to an error, all thedecoded value of macro blocks in a synchronization interval, in whichthe error has occurred, are regarded as “Not Coded”, and the last screenis directly displayed. If all the header information and the modeinformation 1 can be decoded, the bidirectional decoding of the motionvector information is then carried out. A portion of the motion vectorinformation, which can not be decoded, is regarded as “Not Coded”. Inthe lower layer, the DCT coefficient information of the lower layer isused for only macro blocks, which have been decoded to the motionvector. The macro blocks, in which the DCT coefficient information hasbeen abandoned due to the error, are regarded as “Not Coded”.

[0251] While the decoded values have been determined every macro blocksin the decoded-value determining methods shown in FIGS. 53 and 54, thedecoded values may be determined every block or code word. In the fifthpreferred embodiment, while the present invention has been applied tothe variable length codes of the motion vector information and the DCTcoefficient information, the invention may be applied to other sourcesymbols for variable length coding.

[0252] [Sixth Preferred Embodiment]

[0253] The sixth preferred embodiment of a variable length coding and/ordecoding system, according to the present invention, will be describedbelow. Since the basis constructions in the sixth preferred embodimentare the same as those in the first preferred embodiment shown in theblock diagram of FIG. 6, the sixth preferred embodiment will bedescribed referring to FIG. 6.

[0254] In a coding part 113, inputted source symbols are inputted to anencoder 103. A code-word table 102 stores therein source symbolspreviously prepared by a code-word table preparing part 101 and codewords of variable length codes so that the source symbols correspond tothe code words. The encoder 103 selects code words corresponding to theinputted source symbols from the code words stored in the code-wordtable 102. A synchronization interval setting part 104 outputs the codewords selected by the encoder 103, as coded data every synchronizationinterval. The coded data are transmitted to a decoding part 114 via atransmission or storage system 105.

[0255] In the decoding part 114, a synchronization interval detectingpart 106 detects the synchronization interval of the coded data inputtedby the transmission or storage systems 105, and a buffer 107 storestherein the coded data. A forward decoder 108 starts to decode the codeddata stored in the buffer 107 from the prefix of the coded data, and abackward decoder 109 starts to decode the coded data stored in thebuffer 107 from the suffix of the coded data.

[0256] The forward decoder 108 determines that an error is detected,when a bit pattern, which does not exist in a forward code-word table111, appears in the decoded data or when a decoded data having a bitnumber different from the bit number of the buffer 107 is decoded.Similarly, the backward decoder 109 determines that an error isdetected, when a bit pattern, which does not existed in a backwardcode-word table 112, appears in the decoded data and when a decoded datahaving a bit number different from the bit number of the buffer isdecoded.

[0257] The decoded-value determining part determines decoded values onthe basis of a decoded result (a forward decoded result) obtained by theforward decoder and a decoded result (a backward decoded result)obtained by the backward decoder, to output a final decoded result.

[0258]FIG. 55 is a block diagram of the code-word table preparing part101. The occurrence probability of source symbols is inputted to astochastic model preparing part 23 to prepare a stochastic model, whichis inputted to a code selecting part 21. The code selecting part 21selects a code system having a shortest average code length fromselectable code systems to transmit the selected result to a code-wordforming part 22. The code-word forming part 22 forms code words of thecode selected by the code-word selecting part 21.

[0259] In this sixth preferred embodiment, a method for designing astochastic model is as follows. In the sixth preferred embodiment, amethod for designing a generalized stochastic model of a high codingefficiency with respect to various probability distributions of sourcesymbols will be described.

[0260] First, notation will be described.

[0261] θi: Information Source (i=1, . . . , n)

[0262] X: Source Symbols of Information Source X=(x1, x2, . . . , xm)

[0263] P(X|θi): Frequency Distribution of θi

[0264] As an example, a plurality of test images may be used asinformation sources, and the frequency distribution obtained by codingthe test images may be considered.

[0265] A designed stochastic model Q(X) is derived by weighting andaveraging the frequency distribution obtained by the plurality ofinformation source. $\begin{matrix}{{Q(X)} = {{w\left( {\theta \quad 1} \right)}{P\left( {{X\left. {\theta \quad 1} \right)} + \ldots + {{w\left( {\theta \quad n} \right)}{P\left( {X\left. {\theta \quad n} \right)} \right.}}} \right.}}} \\{= {\sum\limits_{i = 1}^{n}{{w\left( {\theta \quad i} \right)}{P\left( {X\left. {\theta \quad n} \right)} \right.}}}}\end{matrix}$

[0266] w(θi): Weighting Factor w(θ1)+ . . . +w(θn) 1

[0267] In this case, it is a problem how to derive the weighting factorw(θi). When the information source θi is coded by Q(X), an ideal codelength L(X|θi) is as follows.$L\left( {{X\left. {\theta \quad i} \right)} = {\sum\limits_{i = 1}^{m}{P\left( {X\left. {\theta \quad i} \right)\log \quad 2\left( {Q(X)} \right)} \right.}}} \right.$

[0268] In order to minimize -he ideal code lengths L(X|θi) of therespective information sources on average, assuming that${{U(X)} = {\left( {1/n} \right){\sum\limits_{i = 1}^{n}{P\left( {X\quad \theta \quad i} \right)}}}},$

$\begin{matrix}{{M(X)} = {{- \left( {1/n} \right)}{\sum\limits_{i = 1}^{n}{\sum\limits_{i = 1}^{m}{{P\left( {X{{\theta \quad i}}} \right)}\log \quad 2\left( {Q(X)} \right)}}}}} \\{= {\sum\limits_{i = 1}^{m}{{U(X)}\quad \log \quad 2\left( {Q(X)} \right)}}}\end{matrix}$

[0269] When U(X)=Q(X), this function is minimum as follows.

[0270] w(θ1)= . . . =w(θn)=1/n

[0271] As another method for designing a stochastic model Q(X), a methodfor designing a stochastic model Q(X) by supposing the worst informationsource will be described.

[0272] When the information source θi is coded by Q(X), redundancyR(X|θi) is as follows.$R\left( {{X\left. {\theta \quad i} \right)} = {L\left( {{X\left. {\theta \quad i} \right)} + {\sum\limits_{i = 1}^{m}{{P\left( {X{{\theta \quad i}}} \right)}\log \quad 2\left( {P\left( {X\left. {\theta \quad i} \right)} \right)} \right.}}} \right.}} \right.$

[0273] A weighting mean S(X) of these redundancy with respect to therespective information sources is a function indicative of a mutualinformation of event X and event θ as follows. $\begin{matrix}{{S(X)} = {\sum\limits_{i = 1}^{n}{{w\left( {\theta \quad i} \right)}{R\left( {X\left. {\theta \quad i} \right)} \right.}}}} \\{= {\sum\limits_{i = 1}^{n}{{w\left( {\theta \quad i} \right)}{P\left( {X{{\theta \quad i}}} \right)}\log \quad 2\left( {P\left( {X{\left. {\theta \quad i} \right)/{\sum\limits_{i = 1}^{n}{{w\left( {\theta \quad i} \right)}{P\left( {X\left. {\theta \quad i} \right)} \right)}}}}} \right.} \right.}}}\end{matrix}$

[0274] As a method for deriving the maximum value of this function,there is known Arimoto-Blahut's algorithm, which is disclosed in “Analgorithm for computing the capacity of arbitrary discrete memorylesschannels” (S. Arimoto, IEEE Trans. Inform. Theory, Vol. IT-18, pp.14-20,1972), and “Computation of channel capacity and rate-distortionfunctions” (R. E. Blahut, IEEE Trans. Inform. Theory, Vol. IT-18,pp.460-473, 1972). By this algorithm or the like, it is possible toderive w(θi) (i=1, . . . , n) having the maximum S(X), i.e., the worstw(θi).

[0275] As methods for designing the stochastic model Q(X), although themethod for minimizing the ideal code length on average and the methodfor supposing the worst information source on average have beendescribed, a method for combining the above two methods to groupinformation sources to prepare some stochastic models by the formermethod to use the latter method for the stochastic models may beapplied.

[0276] The code selecting part 21 shown in FIG. 55 prepares Q(Y), whichis obtained by sorting the source symbols X in order of probability inthe stochastic models Q(X) prepared by the stochastic model preparingpart 23. The code selecting part 21 also prepares F(Z), which isobtained by sorting the code lengths of the reversible codes prepared bythe code forming part 22 in order of shorter length, to calculate$\sum\limits_{i = 1}^{m}{{Q(Y)}{F(Z)}}$

[0277] to select one of i=1 the minimum value to prepare a code-wordtable, in which source symbols correspond to code words.

[0278] As the codes formed by the code-word forming part 22, variablelength codes are used, which are described in, e.g., Japanese PatentApplication 7-89772 or 7-260383, which uses the weights of the codewords and which can be decoded both in the forward and backwarddirections.

[0279] [Seventh Preferred Embodiment]

[0280] The seventh preferred embodiment of the present invention will bedescribed below.

[0281]FIG. 56 is a block diagram illustrating a conception of a movingpicture coding and/or decoding system, which incorporates the seventhpreferred embodiment of a variable length coding and/or decoding systemaccording to the present invention. In a moving picture encoder 709,data coded by a source encoder 702 are variable-length coded andmultiplexed by a moving picture multiplexing part 703 to smoothed by atransmission buffer 704 to be transmitted to a transmission or storagesystem 705 as coded data. A coding control part 701 controls the sourceencoder 702 and the moving picture multiplexing part 703 in view of thebuffer capacity of the transmission buffer 704. In a moving picturedecoder 710, the coded data transmitted from the transmission or storagesystem 705 are stored in a receiving buffer 706 to bemultiplex-separated and variable-length decoded by a moving picturemultiplexing separating part 707 to be transmitted to a source decoder708, so that the moving picture is finally decoded.

[0282] Additional syntax in the seventh preferred embodiment will bedescribed. FIGS. 57A, 57B, 58A and 58B show syntax of a moving picturecoding system in the moving picture multiplexing part 703 and the movingpicture multiplexing separating part 707 in the seventh preferredembodiment. Coded data are separated into upper and lower layers, andsynchronization intervals of the respective layers are set bysynchronization patterns RM and MM. In the lower layer, ST denotes astuffing code capable of being decoded in the backward direction asshown in FIG. 68. As shown in FIG. 69, an intraframe coding frame isseparated into an upper layer, which has a part of mode information ofmacro blocks and INTRA DC, and a lower layer, which has the rest of themode information and an AC-DCT coefficient information, to whichreversible codes are applied. As shown in FIG. 70, an interframe codingframe is separated into an upper layer, which has a part of modeinformation of macro blocks and a motion vector information, and a lowerlayer, which has the rest of the mode information and an AC-DCTcoefficient information, to which reversible codes are applied.

[0283] The coding and decoding of the upper and lower layers shown inFIGS. 57A through 58B are carried out by means of a moving picturemultiplexing part shown in FIG. 59. These constructions are the same asthose of a coding and/or decoding system in the fifth preferredembodiment. That is, although the basic constructions of the movingpicture multiplexing part 703 and the moving picture multiplexingseparating part 707 of FIG. 56 are the same as those shown in FIGS. 57Athrough 58B, the constructions of an upper-layer variable length encoder801, a lower-layer variable length encoder 803, an upper-layer variablelength decoder 805 and a lower-layer variable length decoder 806 aredifferent from those in the second preferred embodiment. That is, out ofdata coded by the source encoder 702, the upper layer data indicated by,e.g., the syntax of FIG. 57A or 58A, are variable-length coded by theupper-layer variable length encoder 801 to be transmitted to themultiplexing part 803. In addition, out of data coded by the sourceencoder 702, the lower layer data indicated by, e.g., the syntax of FIG.57B or 58B, are variable-length coded by the variable length encoder 802to be transmitted to the multiplexing part 803. The coded data of theupper and lower layers are multiplexed by the multiplexing part 803 tobe transmitted to a transmission buffer 704.

[0284] In the seventh preferred embodiment, decoded-value determiningparts 110 (shown in FIG. 37) in the upper-layer variable length decoder805 and the lower-layer variable length decoder 806 determine decodedvalues on the basis of the forward decoded result obtained by a forwarddecoder 108, to output a final decoded result. In the error detection inthe forward decoder 108 and the backward decoder 109 in the respectivelayers, when a bit pattern, which does not exist as code words, appearsor when an error is detected by a check bit or the like, the position ofthe bit pattern or the error is regarded as a detected position, andwhen no error is detected by the above described determining method andwhen the number of decoded bits is not coincident with the bit number ofcoded data in the synchronization interval, the first decoding positionis regarded as an error detected position.

[0285] [Eight Preferred Embodiment]

[0286]FIGS. 60 and 61 show examples of a source encoder 702 and a sourcedecoder 708 in the eighth preferred embodiment of a coding and/ordecoding system according to the present invention. In FIG. 60, an inputpicture signal is divided into macro blocks by means of a blockingcircuit 401. The input picture signal divided into macro blocks isinputted to a subtracter 402, by which a difference between the inputpicture signal and a prediction picture signal is derived to produce aprediction residual signal. One of this prediction residual signal andthe input signal outputted from the blocking circuit 401 is selected bya mode selecting switch 403 to be discrete-cosine-transformed by a DCT(discrete cosine transform) circuit 404. DCT coefficient data obtainedby the DCT circuit are quantized by a quantizer circuit 405. Thequantized data are divided into two parts, one of which is transmittedto a moving picture multiplexer 703 as a DCT coefficient information,and the other of which is sequentially processed by an inverse quantizercircuit 406 and an IDCT (inverse discrete cosine transform) circuit 407,the processes being inverse to those of the quantizer circuit 405 andthe DCT circuit 404, to be added, by means of an adder 408, to theprediction picture signal inputted via a switch 411 to produce a localdecoded signal. This local decoded signal is stored in a frame memory409 and inputted to a motion compensation circuit 410. The motioncompensation circuit 410 carries out the motion compensation between theinput picture signal and the local decoded signal to derive a motionvector to produce a prediction picture signal. The derived motion vectorinformation is transmitted to a moving picture multiplexer 703. A modeselecting circuit 412 determines a prediction system for coding therespective macro blocks, on the basis of information from the motioncompensation circuit 410, to transmit the result to the moving picturemultiplexer 703 as a mode information with quantization parameters andso forth. In FIG. 60, the output coded data are formed by grouping theDCT coding coefficient, the motion vector information and the modeinformation.

[0287] Referring to FIG. 61, the construction of an information sourcedecoder 708 for decoding data coded in FIG. 60 will be described below.FIG. 61 shows an example of the information source decoder 708corresponding to FIG. 60. In FIG. 61, the information source decoder 708receives a mode information divided by a moving picture multiplexingseparating circuit 707, a motion vector information, a DCT coefficientinformation and so forth.

[0288] In a mode determining circuit 504, to which the mode informationis inputted, if the mode information is an INTRA, a mode selectingswitch 505 is turned OFF, and the DCT coefficient information is inversequantized by an inverse quantizer circuit 501 to be inversediscrete-cosine-transformed by an IDCT circuit 502 to produce aregenerative picture signal. This regenerative picture signal is storedin a frame memory 506 as a reference image and outputted as aregenerative picture signal. If the mode information is an INTER, themode selecting switch 505 is turned OFF, and the DCT coefficientinformation is inverse quantized by the inverse quantizer circuit 501 tobe inverse discrete-cosine transformed by the ICDT circuit 502. Then,the reference image is motion-compensated in the frame memory 504 on thebasis of the motion vector information to be added in an adder 503 toproduce a regenerative picture signal. This picture signal is stored inthe frame memory 504 as a reference image and outputted as aregenerative picture signal.

[0289] [Ninth Preferred Embodiment]

[0290] Referring to FIG. 62, as an applied example of the presentinvention, an embodiment of an image transmitter receiver, to which theninth preferred embodiment of a moving picture coding and/or decodingsystem incorporating a variable length coding and/or decoding systemaccording to the present invention is applied, will be described below.

[0291] A picture signal inputted to a camera 1002 mounted on a personalcomputer (PC) 1001 is coded by means of a moving picture encoder 709incorporated in the PC. The coded data outputted from the moving pictureencoder 709 are multiplexed with other informations on voice and data tobe radio-transmitted by a radio transmitter receiver 1003 to be receivedby another radio transmitter receiver 1004. The signal received by theradio transmitter receiver 1004 is divided into coded data and voicedata of a picture signal. The coded data of the picture signal aredecoded by means of a moving picture decoder 710 incorporated in a workstation (EWS) 1005 to be displayed on the EWS 1005.

[0292] Similarly, a picture signal inputted by a camera 1006 mounted onthe EWS 1005 is coded by the moving picture encoder 709 incorporated inthe EWS 1005. The coded data are multiplexed with other information onvoice and data to be radio-transmitted by the radio transmitter receiver1004 to be received by the transmitter receiver 1003. The signalreceived by the transmitter receiver 1003 is divided into coded data andvoice data of the picture signal. The coded data of the picture signalare decoded by means of the moving picture decoder 710 incorporated inthe PC 1001 to be displayed on the PC 1001.

[0293] [Tenth Preferred Embodiment]

[0294] While the present invention has been grasped as a hardwareconstruction of a moving picture coding and/or decoding system in thefirst through ninth preferred embodiments, the invention may be graspedas a recording medium for recording data or programs for use in a codingand/or decoding system the above preferred embodiments. The tenthpreferred embodiment of a recording medium or recording data or programswill be described below.

[0295] In an information source encoder 702 shown in FIG. 56, 8×8 blocksof DCT coefficients after quantization are scanned in the blocks toderive LASTs (0: non-zero coefficient, which is not the last of theblock, 1: non-zero coefficient of the last of the block), RUNs (thenumber of zero runs before the non-zero coefficient) and LEVELs(quantized value of the coefficient), which are transmitted to a movingpicture multiplexing part 703.

[0296] A lower-layer variable length encoder 802 in the moving picturemultiplexing part 703 has an INDEX table wherein INDEXs of code words(VLC_CODE) of reversible codes correspond to RUNs and LEVETs of non-LASTcoefficients of INTRA (intraframe coding) shown in FIG. 66, an INDEXtable wherein INDEXs of code words (VLC_CODE) of reversable codescorrespond to RUNs and LEVELs of non-LAST coefficients of INTER(interframe coding) shown in FIG. 67, an INDEX table wherein INDEXs ofcode words (VLC_CODE) of reversible codes correspond to RUNs and LEVELsof common LAST coefficients of INTRk and INTER shown in FIG. 68, and acode-word table wherein code words correspond to the INDEX values shownin FIGS. 69 and 70.

[0297] Referring to a flow chart of FIG. 63, the operation of thelower-layer variable length encoder 802 will be described. First, on thebasis of the mode information, the code-word table of the non-LASTcoefficients and the LAST coefficients of the INTRA is selected when theINTRA is carried out, and the INDEX table of the non-LAST coefficientsand the LAST coefficients of the INTER when the INTER is carried out(S101). Then, in order to code using the code-word table, (RUN, LEVEL)is compared with the maximum value R_max of the RUNs and the maximumvalue L_max of the LEVELs in the INDEX table, so that it is verifiedwhether (RUN, LEVEL) exists in the INDEX table (S102).

[0298] If it exists therein, the INDEX table of FIGS. 66 through 68 isused to check whether the value of the INDEX is 0 (S104). If it is not0, the code words of the INDEX in the code-word table of FIG. 17 areoutputted. The last bit “s” of the code words in the code-word tabledenotes the sign of the LEVEL. When “s” is “0”, the sign of the LEVEL ispositive, and when “s” is “1”, the sign of the LEVEL is negative (S105).When the value of the INDEX is 0 or beyond the range, ESCAPE codescontinue as shown in FIG. 73 by coefficients, which do not exist in thecode-word table, and 1 bit indicating whether it is a LAST coefficientand the absolute values of the RUNs and LEVELs shown in FIGS. 71 and 72are fixed-length coded. To the prefix of the fixed-length coding part,“00001” of two escapes is added, and to the suffix, an escape code isalso added. The code words, wherein the INDEX values in FIGS. 69 and 70are 0, are escape codes. The last bit “s” of the VLC_CODE used as theESCAPE code denotes the sign of the LEVEL. If the “s” is “0”, the LEVELis positive, and if the “s” is “1”, the LEVEL is negative (S106).

[0299] As described above, if the INDEX table is used, it is possible toefficiently output code words without the need of search even if theESCAPE codes are used. The lower-layer variable length decoder 802 has adecoded-value table shown in FIGS. 74 and 75, and operates on the basisof the INDEX values obtained by decoding variable length codes.

[0300] Referring to flow charts of FIGS. 64 and 65, the operation of thelower-layer variable length decoder will be described below.

[0301]FIG. 64 shows the decoding operation in the forward direction.First, variable length code are decoded in the forward direction (S201).Then, it is check whether the INDEX value obtained by decoding is 0(S202). If it is not 0, the INTRA and INTER of the decoded-value tableof FIG. 74 are selected on the basis of the mode information of theupper layer, to derive decoded values of the LAST, RUN and LEVEL (S203).Since it is an escape code when the INDEX value is 0, the subsequentfixed-length code is decoded to derive decoded values of the LAST, RUNand LEVEL (S204). Subsequently, the end ESCAPE code is decoded (S205).The sign of the LEVEL is positive when the last bit of the code word is“0”, and negative when it is “1” (S206).

[0302]FIG. 65 shows the decoding operation in the backward direction.First, the sign of the LEVEL is determined by the first bit of the codeword. If it is “0”, the sign is positive, and if it is “1”, the sign isnegative (S301). Then, the variable length code is decoded in thebackward direction (S302). Then, it is checked whether the INDEX valueobtained by decoding in the backward direction is 0 (S303). When theINDEX value is not 0, the INTRA and INTER in the decoded-value table ofFIG. 74 are selected on the basis of the mode information of the upperlayer, to derive decoded values of the LAST, RUN and LEVEL (S304). Whenthe INDEX value is 0, it is an escape code, so that the subsequentfixed-length code is decoded to derive decoded values of the LEVEL, RUNand LAST (S305). Subsequently, the first ESCAPE code is decoded (S306).As described above, if the decoded-value table is used, it is possibleto save the memory capacity and to efficiently carry out thebidirectional decoding even if the ESCAPE code is used.

[0303] The supplementary explanation of the decoding process in thetenth preferred embodiment will be given. That is, a decoded-valuedetermining method when the syntax of the moving picture coding systemin the moving picture multiplexing part 703 is syntax shown in FIGS. 57Athrough 58A will be described. First, a mode information 1 and a INTRADC of the upper layer are decoded. If an error is found and the modeinformation 1 and the INTRA DC are not completely decoded, all thedecoded values of macro blocks of a synchronization interval, in whichan error occurs, are regarded as “Not Coded”. If the first frame iscoded and the last frame does not exist, the macro blocks are colored ingray or a special color.

[0304] In the lower layer, when a mode information 2 can not be decodeddue to an error, all the coded data of the lower layer are abandoned,and the decoded values of the upper layer are rewritten to be regardedas “Not Coded”, or indicated by only the INTRA DC. When AC-DCTcoefficients are predicted in some of macro blocks of the INTRA mode,variable length codes can be decoded. However, since the prediction iscarried out on the basis of the surrounding macro blocks, when thevariable length codes can not be decoded in the surrounding macroblocks, the decoded values are regarded as “Not Coded”.

[0305] In the interframe coding frame, the mode information 1 and themotion vector of the upper layer are first decoded. If an error isfounded and the mode information 1 and the motion vector can not becompletely decoded, all the decoded values of the macro blocks of asynchronization interval, in which the error occurs, are regarded as“Not Coded”. If all can be decoded, it is verified that thesynchronization interval MM exists. If it does not exist, all thedecoded values of the macro blocks of the synchronization interval areregarded as “Not Coded”.

[0306] In the lower layer, when the mode information 2 and the INTRA DCcan not be decoded due to an error, the coded data of the lower layerare abandoned, and the decoded values of the upper layer are rewrittenby the indication of “Not Coded” or the indication (MC Not Coded) ofonly motion vectors from the last frame.

[0307] If the AC-DCT coefficients are predicted in some macro blocks ofthe INTRA mode, the variable length codes can be decoded. However, sincethe prediction is carried out on the basis of the surrounding macroblocks, when the variable length codes can not be decoded in thesurrounding macro blocks, the decoded values are regarded as “NotCoded”.

[0308]FIG. 76 shows a detailed decoded-value determining method in theAC-DCT coefficient portion of the interframe coding frame. First, asshown in FIG. 76(a), when the ways to the positions (error detectedpositions) of a macro block, in which errors are detected in the forwardand backward decoded results, do not overlap with each other, only thedecoded results of a macro block, in which no error has been decoded,are used as decoded values, and the decoded results at the two errordetected positions are not used. In addition, the decoded results of theupper layer are rewritten on the basis of the decoded results of theupper layer so that the INTRA macro block is directly indicated by thelast frame and the INTRA macro block is indicated only by the motioncompensation using the last frame.

[0309] As shown in FIG. 76(b), when the ways to the error detectedpositions overlap with each other in the forward and backward decodedresults, the forward decoded results are used for decoded values beforethe macro block, in which the error has been detected in the forwarddecoded result, and the backward decoded results are used for decodedvalues after the macro block.

[0310] Alternatively, the backward decoded results may be preferentiallyused for decoded values before the macro block, in which the error hasbeen detected in the backward decoded result, and the forward decodedresults may be used for decoded values after the macro block.

[0311] As shown in FIG. 76(c), when errors are detected in the samemacro block both in the forward and backward decoded results, thedecoded values in the macro block at the error detected position areabandoned and are not used for decoded values. In addition, the decodedresults of the upper layer are rewritten on the basis of the decodedresults of the mode information of the upper layer so that the INTRAmacro block is directly indicated by the last frame and he INTER macroblock is indicated by only the motion compensation using the last frame,and the backward decoded results are used for the decoded values afterthe macro block.

[0312] As shown in FIG. 76(d), when an error is detected in the stuffingcode and the decoding can not be decoded in the backward direction, thedecoding is carried out only in the forward direction. When the error isdetected, the decoded results of the upper layer with respect to themacro blocks after the error detected position are rewritten on thebasis of the decoded results of the mode information of the upper layerso that the INTRA macro blocks are directly indicated by the last frameand the INTER macro blocks are Indicated only by the motion compensationusing the last frame.

[0313] While the decoded values have been determined every macro blocksin the decoded-value determining method of FIG. 76, the detected valuesmay be determined every block or code word.

[0314] As described in the above preferred embodiments, a variablelength coding and/or decoding system of the present invention requiressmaller amounts of calculation and storage to be efficient.Specifically, the variable length coding and/or decoding system can beapplied to a moving picture coding and/or decoding, and it is possibleto provide an efficient moving picture coding and/or decoding systemwith smaller amounts of calculation and storage.

What is claimed is:
 1. A variable length coding system, which assigns,to a plurality of source symbols, code words having a code lengthcorresponding to the occurrence probability of the source symbols andwhich outputs code words corresponding to inputted source symbols ascoded data, said variable length coding system comprising: a code-wordtable for storing therein a plurality of code words including codeswords, which are capable of being decoded both in forward and backwarddirections and which are formed so that delimiters of the code words arecapable of being identified by a predetermined weight of the code words,so that said plurality of code words correspond to source symbols;code-word selecting means for selecting code words corresponding toinputted source symbols from the code-word table; and synchronizationinterval setting means for preparing coded data for each ofpredetermined synchronization intervals using code words selected bysaid code-word selecting means and for inserting stuffing codes capableof being decoded in the backward direction.
 2. A variable length codingsystem as set forth in claim 1, wherein said code words, which arecapable of being decoded both in the forward and backward directions andwhich are formed so that the delimiters of the code words are capable ofbeing identified by a predetermined weight of the code words, have firstand second code words, which are capable of being decoded both in theforward and backward directions, said second code word being added to atleast one of the prefix and suffix of said first code word.
 3. Avariable length coding system as set forth in claim 1, wherein said codewords, which are capable of being decoded both in the forward andbackward directions and which are formed so that the delimiters of thecode words are capable of being identified by a predetermined weight ofthe code words, have first and second code words, which are capable ofbeing decoded both in the forward and backward directions, said secondcode word being added at least one of immediately before and after therespective bits of said first code word.
 4. A variable length codingsystem as set forth in claim 1, wherein said code words, which arecapable of being decoded both in the forward and backward directions andwhich are formed so that the delimiters of the code words are capable ofbeing identified by a predetermined weight of the code words, have codewords, which are capable of being decoded both in the forward andbackward directions and between the respectively bits of which codewords of a fixed length code are inserted by predetermined bits.
 5. Avariable length coding system as set forth in claim 1, wherein said codewords, which are capable of being decoded both in the forward andbackward directions and which are formed so that the delimiters of thecode words are capable of being identified by a predetermined weight ofthe code words, have first and second code words, which are capable ofbeing decoded both in forward and backward directions, said second codeword being inserted between the respective bits of said first code word.6. A variable length coding system, which assigns, to a plurality ofsource symbols, code words having a code length corresponding to theoccurrence probability of the source symbols and which outputs codewords corresponding to inputted source symbols as coded data, saidvariable length coding system comprising: layering means for layeringinputted source symbols in accordance with importance; a code-word tablefor storing therein a plurality of code words including codes words,which are capable of being decoded both in the forward and backwarddirections and which are formed so that the delimiters of the code wordsare capable of being identified by a predetermined weight of the codewords, so that said plurality of code words correspond to the sourcesymbols; code-word selecting means for selecting code wordscorresponding to the inputted source symbols layered by said layeringmeans, from the code-word table; and synchronization interval settingmeans for preparing coded data of each of layers for each ofpredetermined synchronization intervals using code words selected bysaid code-word selecting means and for multiplexing the coded data ofeach of layers.
 7. A variable length coding system as set forth in claim6, wherein said code words, which are capable of being decoded both inthe forward and backward directions and which are formed so that thedelimiters of the code words are capable of being identified by apredetermined weight of the code words, have first and second codewords, which are capable of being decoded both in the forward andbackward directions, said second code word being added to at least oneof the prefix and suffix of said first code word.
 8. A variable lengthcoding system as set forth in claim 6, wherein said code words, whichare capable of being decoded both in the forward and backward directionsand which are formed so that the delimiters of the code words arecapable of being identified by a predetermined weight of the code words,have first and second code words, which are capable of being decodedboth in the forward and backward directions, said second code word beingadded at least one of immediately before and after the respective bitsof said first code word.
 9. A variable length coding system as set forthin claim 6, wherein said code words, which are capable of being decodedboth in the forward and backward directions and which are formed so thatthe delimiters of the code words are capable of being identified by apredetermined weight of the code words, have code words, which arecapable of being decoded both in the forward and backward directions andbetween the respectively bits of which code words of a fixed length codeare inserted by predetermined bits.
 10. A variable length coding systemas set forth in claim 6, wherein said code words, which are capable ofbeing decoded both in the forward and backward directions and which areformed so that the delimiters of the code words are capable of beingidentified by a predetermined weight of the code words, have first andsecond code words, which are capable of being decoded both in theforward and backward directions, said second code word being insertedbetween the respective bits of said first code word.
 11. A variablelength decoding system for decoding coded data, which are of variablelength codes of code words containing code words capable of beingdecoded both in forward and backward directions and into which stuffingcodes capable of being decoded in the backward direction are insertedevery predetermined synchronization interval, said variable lengthdecoding system comprising: synchronization interval detecting means fordetecting a synchronization interval of said coded data; forwarddecoding means for decoding, in the forward direction, the coded data inthe synchronization interval detected by said synchronization intervaldetecting means; and backward decoding means for decoding, in thebackward direction, the data in the synchronization interval detected bysaid synchronization interval detecting means.
 12. A variable lengthdecoding system as set forth in claim 11, wherein when a code word,which does not exist in a code-word table of a variable length code,appears in the coded data, at least one of said forward decoding meansand said backward decoding means detects the coded data as an error. 13.A variable length decoding system as set forth in claim 11, wherein whenthe bit number of the decoded coded data is not coincident with the bitnumber of transmitted coded data, at least one of said forward decodingmeans and said backward decoding means detects as an error.
 14. Avariable length decoding system as set forth in claim 11, wherein when adecoded value obtained by decoding the coded data is inadequate, atleast one of said forward decoding means and said backward decodingmeans detects as an error of decoding processing.
 15. A variable lengthdecoding system as set forth in claim 11, wherein said synchronizationinterval detecting means detects the bit number of said coded data bydecoding said stuffing code in the backward direction.
 16. A variablelength decoding system for decoding coded data, which are of variablelength codes of code words containing code words capable of beingdecoded both in forward and backward directions and into which stuffingcodes capable of being decoded in the backward direction are insertedevery predetermined synchronization interval, said variable lengthdecoding system comprising: synchronization interval detecting means fordetecting a synchronization interval of said coded data; forwarddecoding means for decoding, in the forward direction, the coded data inthe synchronization interval detected by said synchronization intervaldetecting means; backward decoding means for decoding, in the backwarddirection, the data in the synchronization interval detected by saidsynchronization interval detecting means; and decoded-value determiningmeans for determining a decoded value on the basis of decoded results ofsaid forward decoding means and said backward decoding means to output afinal decoded result.
 17. A variable length decoding system as set forthin claim 16, wherein when a code word, which does not exist in acode-word table of a variable length code, appears in the coded data, atleast one of said forward decoding means and said backward decodingmeans detects the coded data as an error.
 18. A variable length decodingsystem as set forth in claim 16, wherein when the bit number of thedecoded coded data is not coincident with the bit number of transmittedcoded data, at lease one of said forward decoding means and saidbackward decoding means detects as an error.
 19. A variable lengthdecoding system as set forth in claim 16, wherein when a decoded valueobtained by decoding coded data is inadequate, at least one of saidforward decoding means and said backward decoding means detects as anerror of decoding processing.
 20. A variable length decoding system asset forth in claim 16, wherein when an error is detected by at least oneof said forward decoding means and said backward decoding means, saiddecoded-value determining means uses a decoded result, which is presumedto be correct, of decoded results of said forward decoding means andsaid backward decoding means, and abandons a portion which is not ableto be decoded in both of the decoded results.
 21. A variable lengthdecoding system as set forth in claim 16, wherein said decoded-valuedetermining means: (a) uses, as decoded values, only decoded values, inwhich no error is detected, when said error is detected in both of saidforward decoding means and said backward decoding means and when theways to the error detected positions do not overlap with each other; (b)uses forward decoded results as decoded values for code wordsimmediately before a position, at which said error is found by saidforward decoding means, and uses backward decoded results as decodedvalues for code words after the position, when errors have been detectedboth in said forward decoding means and said backward decoding means andwhen the ways to error detected positions overlap with each other; (c)uses forward decoded results as coded values for code words immediatelybefore a position, at which said error is detected, and uses backwarddecoded results as decoded values for code words after the position,when said error has been detected by only one of said forward decodingmeans and said backward decoding means; and (d) abandons decoded valuesfor code words at the position, at which said error has been decoded,and uses backward decoded results as decoded values for code words afterthe position, when said error has been detected for the same code wordby said forward decoding means and said backward decoding means.
 22. Avariable length decoding system as set forth in claim 16, wherein saiddecoded-value determining means abandons all the decoded results, inwhich there is a probability that an error may exist, when said errorhas been detected by at least one of said forward decoding means andsaid backward decoding means.
 23. A variable length decoding means asset forth in claim 16, wherein said synchronization interval detectingmeans detects the bit number of said coded data by decoding saidstuffing codes in the backward direction.
 24. A variable length decodingsystem for decoding coded data every predetermined synchronizationinterval, said coded data comprising variable length codes, which are ofcode words containing code words capable of being decoded both inforward and backward directions, and said coded data being prepared bycode words corresponding to layered source symbols to be multiplexed,said variable length decoding system comprising: dividing means fordividing said multiplexed coded data into respective layers;synchronization interval detecting means for detecting a synchronizationinterval of said coded data divided by said dividing means; forwarddecoding means for decoding, in the forward direction, the coded data inthe synchronization interval detected by said synchronization intervaldetecting means; backward decoding means for decoding, in the backwarddirection, the data in the synchronization interval detected by saidsynchronization interval detecting means; and synthesizing means forsynthesizing decoded results of respective layers obtained by saidforward decoding means and said backward decoding means.
 25. A variablelength decoding system as set forth in claim 24, wherein when a codeword, which does not exist in a code-word table of a variable lengthcode, appears in the coded data, at least one of said forward decodingmeans and said backward decoding means detects the coded data as anerror.
 26. A variable length decoding system as set forth in claim 24,wherein when the bit number of the decoded coded data is not coincidentwith the bit number of transmitted coded data, at lease one of saidforward decoding means and said backward decoding means detects as anerror.
 27. A variable length decoding system as set forth in claim 24,wherein when a decoded value obtained by decoding coded data isinadequate, at least one of said forward decoding means and saidbackward decoding means detects as an error of decoding processing. 28.A variable length decoding system for decoding coded data everypredetermined synchronization interval, said coded data comprisingvariable length codes, which are of code words containing code wordscapable of being decoded both in forward and backward directions, andsaid coded data being prepared by code words corresponding to layeredsource symbols to be multiplexed, said variable length decoding systemcomprising: dividing means for dividing said multiplexed coded data intorespective layers; synchronization interval detecting means fordetecting a synchronization interval of said coded data divided by saiddividing means; forward decoding means for decoding, in the forwarddirection, the coded data in the synchronization interval detected bysaid synchronization interval detecting means; backward decoding meansfor decoding, in the backward direction, the data in the synchronizationinterval detected by said synchronization interval detecting means;decoded-value determining means for determining decoded values on thebasis of decoded results of respective layers obtained by said forwarddecoding means and said backward decoding means, to output final decodedresults; and synthesizing means for synthesizing final decoded resultsof respective layers obtained by said decoded-value determining means.29. A variable length decoding system as set forth in claim 28, whereinwhen a code word, which does not exist in a code-word table of avariable length code, appears in the coded data, at least one of saidforward decoding means and said backward decoding means detects thecoded data as an error.
 30. A variable length decoding system as setforth in claim 28, wherein when the bit number of the decoded coded datais not coincident with the bit number of transmitted coded data, atlease one of said forward decoding means and said backward decodingmeans detects as an error.
 31. A variable length decoding system as setforth in claim 28, wherein when a decoded value obtained by decodingcoded data is inadequate, at least one of said forward and backwarddecoding means detects as an error of decoding processing.
 32. Avariable length decoding system as set forth in claim 28, wherein whenan error is detected by at least one of said forward decoding means andsaid backward decoding means, said decoded-value determining means usesa decoded result, which is presumed to be correct, of decoded results ofsaid forward decoding means and said backward decoding means, andabandons a portion which is not able to be decoded in both of thedecoded results.
 33. A variable length decoding system as set forth inclaim 28, wherein said decoded-value determining means: (a) uses, asdecoded values, only decoded values, in which no error has beendetected, when said error is detected in both of said forward decodingmeans and said backward decoding means and when the ways to the errordetected positions do not overlap with each other; (b) uses forwarddecoded results as decoded values for code words immediately before aposition, at which said error is found by said forward decoding means,and uses backward decoded results as decoded values for code words afterthe position, when errors are detected both in said forward decodingmeans and said backward decoding means and when the ways to errordetected positions overlap with each other; (c) uses forward decodedresults as coded values for code words immediately before a position, atwhich said error is detected, and uses backward decoded results asdecoded values for code words after the position, when said error isdetected by only one of said forward decoding means and said backwarddecoding means; and (d) abandons decoded values for code words at theposition, at which said error has been decoded, and uses backwarddecoded results as decoded values for code words after the position,when said error is detected for the same code word by said forwarddecoding means and said backward decoding means.
 34. A variable lengthdecoding system as set forth in claim 16, wherein said decoded-valuedetermining means abandons all the decoded results, in which there is aprobability that an error may exist, when said error is detected by atleast one of said forward decoding means and said backward decodingmeans.
 35. A variable length decoding system for decoding coded data,which are of variable length codes of code words containing code wordscapable of being decoded both in forward and backward directions andinto which stuffing codes capable of being decoded in a backwarddirection are inserted every predetermined synchronization interval,said variable length decoding system comprising: synchronizationinterval detecting means for detecting a synchronization interval ofsaid coded data; and bidirectional decoding means for decoding, both inforward and backward directions, the coded data in the synchronizationinterval detected by said synchronization interval detecting means. 36.A variable length decoding system as set forth in claim 35, wherein saidsynchronization interval detecting means detects the bit number of saidcoded data by decoding said stuffing code in the backward direction. 37.A variable length decoding system as set forth in claim 35, wherein whena code word, which does not exist in a code-word table of a variablelength code, appears in the coded data in at least one of said forwardand backward decoding processes, said bidirectional decoding meansdetects said code word as an error.
 38. A variable length decodingsystem as set forth in claim 35, wherein when the bit number of thedecoded coded data is not coincident with the bit number of transmittedcoded data in at lease one of said forward and backward decodingprocesses, said bidirectional decoding means detects as an error.
 39. Avariable length decoding system as set forth in claim 35, wherein when adecoded value obtained by decoding coded data is inadequate in at leastone of said forward and backward decoding processes, said bidirectionaldecoding means detects as an error of decoding processing.
 40. Avariable length decoding system as set forth in claim 39, wherein saidbidirectional decoding means carries out the backward decoding processfrom the suffix of said coded data after carrying out the forwarddecoding process.
 41. A variable length decoding system as set forth inclaim 40, wherein said bidirectional decoding means stops the forwarddecoding process and carries out the backward decoding process from thesuffix of the coded data, when an error is detected in the forwarddecoding process.
 42. A variable length coding system as set forth inclaim 40, wherein said bidirectional decoding means carries out thebackward decoding process from the suffix of the coded data aftercarrying out the forward decoding process.
 43. A variable lengthdecoding system as set forth in claim 40, wherein when an error isdetected in the forward decoding process, said bidirectional decodingmeans resumes the forward decoding process from a position apart fromthe position of the error by a predetermined distance.
 44. A variablelength decoding system as set forth in claim 40, wherein when an erroris detected in the forward decoding process, said bidirectional decodingmeans carries out the backward decoding process from a position apartfrom the position of the error by a predetermined distance to theposition of the error.
 45. A variable length decoding system as setforth in claim 35, wherein said bidirectional decoding means carries outthe backward decoding process from the suffix of said coded data aftercarrying out the forward decoding process.
 46. A variable lengthdecoding system as set forth in claim 45, wherein when an error isdetected in the forward decoding process, said bidirectional decodingmeans carries out the backward decoding process from a position apartfrom the position of the error by a predetermined distance to theposition of the error.
 47. A variable length decoding system as setforth in claim 45, wherein said bidirectional decoding means carries outthe backward decoding process only when an error is detected in thesuffix of the coded data in the forward decoding process.
 48. Arecording medium for having recorded therein data for use in a variablelength coding and/or decoding system, said recording medium havingrecorded therein variable length coded data capable of being inputtedand outputted by the variable length coding and/or decoding system, saidrecording medium recording therein: coded data including code words,which are capable of being decoded both in forward and backwarddirection and which are formed so that the delimiters of the code wordsare identified by a predetermined weight of the code words; and data, inwhich stuffing codes capable of being decoded in the backward directionevery predetermined synchronization interval are inserted into saidcoded data.
 49. A recording medium for having recorded therein data foruse in a variable length coding and/or decoding system, said recordingmedium having recorded therein transform coefficient data capable ofbeing produced by orthogonal transforming every block in an image codingand/or decoding system, said recording medium recording therein: saidtransform coefficient data, wherein a plurality of code words capable ofbeing decoded both in forward and backward directions correspond toorthogonal transform coefficients having high appearance frequenciesother than the last orthogonal transform coefficients of the block, foreach of a plurality of coded modes of said image coding and/or decodingsystem; data, wherein a plurality of code words capable of being decodedboth in the forward and backward directions are commonly provided for aplurality of coded modes of said image coding and/or decoding system andcorrespond to orthogonal transform coefficients having high appearancefrequencies of the last orthogonal transform coefficients of the block;data, wherein transform coefficient data having a low appearancefrequency are described by fixed length codes, and code words capable ofbeing decoded both in forward and backward directions are added to theprefix and suffix thereof; and data, wherein stuffing codes capable ofbeing decoded in the backward direction are inserted in the coded dataevery predetermined synchronization interval.
 50. A recording mediumhaving recorded therein a program for use in a variable length codingsystem, which assigns, to a plurality of source symbols, code wordshaving a code length according to occurrence probability of the sourcesymbols, to output code words corresponding to inputted source symbolsas coded data, said recording medium including at least the steps of:storing a code-word table, wherein a plurality of code words includingcode words, which are capable of being decoded both in forward andbackward directions and which are formed so that the delimiters of thecode words are capable of being identified by a predetermined weight ofthe code words, correspond to source symbols; selecting code wordscorresponding to said inputted source symbols from said code-word table;and preparing coded data every synchronization interval by using thecode words selected by said code-word selecting step, and setting asynchronization interval to said code words by inserting stuffing codescapable of being decoded in the backward direction.
 51. A recordingmedium having recorded therein a program for use in a variable lengthdecoding system for decoding coded data, which are of variable lengthcodes of code words including code words capable of being decoded bothin forward and backward directions and into which stuffing codes capableof being decoded in the backward direction are inserted everypredetermined synchronization interval, said recording medium includingat least the steps of: detecting a synchronization interval of saidcoded data; decoding the coded data in the synchronization intervaldetected by said synchronization interval detecting step in the forwarddirection; and decoding the coded data in the synchronization intervaldetected by said synchronization interval detecting step in the backwarddirection.